` elements.
-
-& {
- margin: 0; // 1
- font-family: $theme-font-family;
- font-size: $font-size-base;
- font-weight: $font-weight-base;
- line-height: $line-height-base;
- color: $themed-font-color;
- text-align: left; // 3
- background-color: $white; // 2
-}
-
-// Future-proof rule: in browsers that support :focus-visible, suppress the focus outline
-// on elements that programmatically receive focus but wouldn't normally show a visible
-// focus outline. In general, this would mean that the outline is only applied if the
-// interaction that led to the element receiving programmatic focus was a keyboard interaction,
-// or the browser has somehow determined that the user is primarily a keyboard user and/or
-// wants focus outlines to always be presented.
-//
-// See https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible
-// and https://developer.paciellogroup.com/blog/2018/03/focus-visible-and-backwards-compatibility/
-[tabindex='-1']:focus:not(:focus-visible) {
- outline: 0 !important;
-}
-
-// Content grouping
-//
-// 1. Add the correct box sizing in Firefox.
-// 2. Show the overflow in Edge and IE.
-
-hr {
- box-sizing: content-box; // 1
- height: 0; // 1
- overflow: visible; // 2
-}
-
-//
-// Typography
-//
-
-// Remove top margins from headings
-//
-// By default, ``-`` all receive top and bottom margins. We nuke the top
-// margin for easier control within type scales as it avoids margin collapsing.
-// stylelint-disable-next-line selector-list-comma-newline-after
-h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
- margin-top: 0;
- margin-bottom: 0.5rem;
- font-weight: normal;
-}
-
-// Reset margins on paragraphs
-//
-// Similarly, the top margin on ` `s get reset. However, we also reset the
-// bottom margin to use `rem` units instead of `em`.
-p {
- margin-top: 0;
- margin-bottom: 1rem;
-}
-
-// Abbreviations
-//
-// 1. Duplicate behavior to the data-* attribute for our tooltip plugin
-// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
-// 3. Add explicit cursor to indicate changed behavior.
-// 4. Remove the bottom border in Firefox 39-.
-// 5. Prevent the text-decoration to be skipped.
-
-abbr[title],
-abbr[data-original-title] {
- // 1
- text-decoration: underline; // 2
- text-decoration: underline dotted; // 2
- cursor: help; // 3
- border-bottom: 0; // 4
- text-decoration-skip-ink: none; // 5
-}
-
-address {
- margin-bottom: 1rem;
- font-style: normal;
- line-height: inherit;
-}
-
-ol,
-ul,
-dl {
- margin-top: 0;
- margin-bottom: 1rem;
-}
-
-ol ol,
-ul ul,
-ol ul,
-ul ol {
- margin-bottom: 0;
-}
-
-dt {
- font-weight: $font-weight-bold;
-}
-
-dd {
- margin-bottom: 0.5rem;
- margin-left: 0; // Undo browser default
-}
-
-blockquote {
- margin: 0 0 1rem;
-}
-
-b,
-strong {
- font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari
-}
-
-small {
- font-size: 80%;
-}
-
-//
-// Links
-//
-
-a {
- color: $theme-primary;
- text-decoration: none;
- background-color: transparent; // Remove the gray background on active links in IE 10.
- &:hover {
- color: $theme-primary_d2;
- text-decoration: none;
- }
-}
-
-// And undo these styles for placeholder links/named anchors (without href).
-// It would be more straightforward to just use a[href] in previous block, but that
-// causes specificity issues in many other styles that are too complex to fix.
-// See https://github.com/twbs/bootstrap/issues/19402
-
-a:not([href]) {
- color: inherit;
- text-decoration: none;
-
- &:hover {
- color: inherit;
- text-decoration: none;
- }
-}
-
-//
-// Images and content
-//
-
-img {
- vertical-align: middle;
- border-style: none; // Remove the border on images inside links in IE 10-.
- display: inline-block; // CSS Frameworks e.g. TW, Chakra-ui reset display as block
-}
-
-svg {
- // Workaround for the SVG overflow bug in IE10/11 is still required.
- // See https://github.com/twbs/bootstrap/issues/26878
- overflow: hidden;
- vertical-align: middle;
- display: inline-block; // CSS Frameworks e.g. TW, Chakra-ui reset display as block
-}
-
-//
-// Forms
-//
-
-// Work around a Firefox/IE bug where the transparent `button` background
-// results in a loss of the default `button` focus styles.
-//
-// Credit: https://github.com/suitcss/base/
-button:focus {
- outline: 1px dotted;
- outline: 5px auto -webkit-focus-ring-color;
-}
-
-input,
-button,
-select,
-optgroup,
-textarea {
- margin: 0; // Remove the margin in Firefox and Safari
- font-family: inherit;
- //@include font-size(inherit);
- font-size: inherit;
- line-height: inherit;
-}
-
-button,
-input {
- overflow: visible; // Show the overflow in Edge
-}
-
-button,
-select {
- text-transform: none; // Remove the inheritance of text transform in Firefox
-}
-
-// Set the cursor for non-`` buttons
-//
-// Details at https://github.com/twbs/bootstrap/pull/30562
-[role='button'] {
- cursor: pointer;
-}
-
-// Remove the inheritance of word-wrap in Safari.
-//
-// Details at https://github.com/twbs/bootstrap/issues/24990
-select {
- word-wrap: normal;
-}
-
-// 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
-// controls in Android 4.
-// 2. Correct the inability to style clickable types in iOS and Safari.
-button,
-[type="button"], // 1
-[type="reset"],
-[type="submit"] {
- -webkit-appearance: button; // 2
-}
-
-// Opinionated: add "hand" cursor to non-disabled button elements.
-button,
-[type='button'],
-[type='reset'],
-[type='submit'] {
- &:not(:disabled) {
- cursor: pointer;
- }
-}
-
-// Remove inner border and padding from Firefox, but don't restore the outline like Normalize.
-button::-moz-focus-inner,
-[type='button']::-moz-focus-inner,
-[type='reset']::-moz-focus-inner,
-[type='submit']::-moz-focus-inner {
- padding: 0;
- border-style: none;
-}
-
-input[type='radio'],
-input[type='checkbox'] {
- box-sizing: border-box; // 1. Add the correct box sizing in IE 10-
- padding: 0; // 2. Remove the padding in IE 10-
-}
-
-textarea {
- overflow: auto; // Remove the default vertical scrollbar in IE.
- // Textareas should really only resize vertically so they don't break their (horizontal) containers.
- resize: vertical;
-}
-
-// Correct the cursor style of increment and decrement buttons in Chrome.
-[type='number']::-webkit-inner-spin-button,
-[type='number']::-webkit-outer-spin-button {
- height: auto;
-}
-
-[type='search'] {
- // This overrides the extra rounded corners on search inputs in iOS so that our
- // `.form-control` class can properly style them. Note that this cannot simply
- // be added to `.form-control` as it's not specific enough. For details, see
- // https://github.com/twbs/bootstrap/issues/11586.
- outline-offset: -2px; // 2. Correct the outline style in Safari.
- -webkit-appearance: none;
-}
-
-//
-// Remove the inner padding in Chrome and Safari on macOS.
-//
-
-[type='search']::-webkit-search-decoration {
- -webkit-appearance: none;
-}
-
-//
-// 1. Correct the inability to style clickable types in iOS and Safari.
-// 2. Change font properties to `inherit` in Safari.
-//
-
-::-webkit-file-upload-button {
- font: inherit; // 2
- -webkit-appearance: button; // 1
-}
-
-// Always hide an element with the `hidden` HTML attribute (from PureCSS).
-// Needed for proper display in IE 10-.
-[hidden] {
- display: none !important;
-}
diff --git a/packages/clerk-js/src/ui/styles/_injections.scss b/packages/clerk-js/src/ui/styles/_injections.scss
deleted file mode 100644
index 88cb16e5bea..00000000000
--- a/packages/clerk-js/src/ui/styles/_injections.scss
+++ /dev/null
@@ -1,35 +0,0 @@
-$theme-primary: var(--clerk-primary);
-$theme-primary-d1: var(--clerk-primary-d1);
-$theme-primary-d2: var(--clerk-primary-d2);
-$theme-primary-l1: var(--clerk-primary-l1);
-$theme-primary-l2: var(--clerk-primary-l2);
-$theme-primary-a1: var(--clerk-primary-a1);
-$theme-primary-a2: var(--clerk-primary-a2);
-
-$theme-font-family: var(--clerk-font-family);
-$theme-font-color: var(--clerk-font-color);
-$theme-font-color-l1: var(--clerk-font-color-l1);
-$theme-label-font-weight: var(--clerk-label-font-weight);
-$theme-border-radius: var(--clerk-border-radius);
-$theme-background-color: var(--clerk-background-color);
-$theme-box-shadow: var(--clerk-box-shadow);
-
-$theme-accounts-background-color: var(--clerk-accounts-background-color);
-
-$theme-button-font-family: var(--clerk-button-font-family);
-$theme-button-font-color: var(--clerk-button-font-color);
-$theme-button-font-weight: var(--clerk-button-font-weight);
-
-$font-size-base: 1rem !default;
-$small-font-size: 80% !default;
-
-$font-weight-lighter: lighter !default;
-$font-weight-light: 300 !default;
-$font-weight-normal: 400 !default;
-$font-weight-bold: 700 !default;
-$font-weight-bolder: bolder !default;
-$font-weight-base: $font-weight-normal !default;
-
-$line-height-base: 1.5 !default;
-
-$white: #fff !default;
diff --git a/packages/clerk-js/src/ui/styles/_sharedComponentsOverwrites.scss b/packages/clerk-js/src/ui/styles/_sharedComponentsOverwrites.scss
deleted file mode 100644
index 5aa11b93c4d..00000000000
--- a/packages/clerk-js/src/ui/styles/_sharedComponentsOverwrites.scss
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This file contains necessary overwrites in @clerk/shared components
- * in order to use them in Clerk JS Authentication components, namely
- * , , , .
- *
- * After migrating fully to @clerk/shared components some of these styles
- * will be consolidated with the original shared component styles.
- */
-
-@import 'injections';
-
-.otp-input {
- button {
- padding-top: 0;
- padding-bottom: 0;
- }
-}
-
-button {
- &:hover {
- filter: none;
- }
-}
diff --git a/packages/clerk-js/src/ui/styles/_signInAccountSwitcher.scss b/packages/clerk-js/src/ui/styles/_signInAccountSwitcher.scss
deleted file mode 100644
index 8e65c2afcae..00000000000
--- a/packages/clerk-js/src/ui/styles/_signInAccountSwitcher.scss
+++ /dev/null
@@ -1,19 +0,0 @@
-.sing-in-account-switcher {
- .auth-form-header {
- padding-top: 2rem;
- }
-
- p {
- text-align: center;
- color: $themed-font-color-l1;
- margin-bottom: 2rem;
- }
-
- .active-accounts-manager {
- margin: 0 -2rem;
-
- @include media(upto small) {
- margin: 0 -1.5rem;
- }
- }
-}
diff --git a/packages/clerk-js/src/ui/styles/_theme.scss b/packages/clerk-js/src/ui/styles/_theme.scss
deleted file mode 100644
index f2d511f09a5..00000000000
--- a/packages/clerk-js/src/ui/styles/_theme.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-.themed-card {
- border-radius: $theme-border-radius;
-}
diff --git a/packages/clerk-js/src/ui/styles/_userbutton.scss b/packages/clerk-js/src/ui/styles/_userbutton.scss
deleted file mode 100644
index bea87b6e6b0..00000000000
--- a/packages/clerk-js/src/ui/styles/_userbutton.scss
+++ /dev/null
@@ -1,89 +0,0 @@
-&.user-button {
- display: inline-block;
- height: 2rem;
- background-color: transparent;
-}
-
-.sign-in-profile-image {
- display: block;
- border-radius: 50%;
-}
-
-.user-button-trigger {
- display: flex;
- align-items: center;
- gap: 1em;
-
- height: 100%;
- width: 100%;
- padding: 0;
- border: none;
- white-space: nowrap;
- overflow: hidden;
-
- background-size: 100%;
- background-color: transparent;
-
- > .user-button-avatar {
- height: 100%;
- outline: 0;
- border-radius: 50%;
- }
-}
-
-&.user-button-popup {
- z-index: $high-z-index;
- background-color: $theme-background-color;
- box-shadow: $cl-box-shadow-lg;
- border-radius: $theme-border-radius;
- overflow: hidden;
- max-width: 98%;
- width: 380px;
- padding: 3rem 0;
-}
-
-.user-button-avatar {
- color: $themed-font-color-l1;
-}
-
-// top section
-.user-button-popup-current-account {
- padding-right: 2.625rem;
- padding-left: 2.625rem;
- text-align: center;
-
- .user-button-avatar {
- display: inline-block;
- margin-bottom: 1rem;
- }
-
- .user-button-headline {
- font-size: 1.5rem;
- font-weight: $font-weight-bolder;
- text-align: center;
-
- @include text-ellipsis;
- }
-
- .user-button-identifier {
- text-align: center;
- color: $cl-gray-light-3;
- margin-bottom: 1.5rem;
- }
-}
-
-&.user-button-popup .active-accounts-manager {
- .active-account-buttonset {
- padding-right: 2.625rem;
- padding-left: 2.625rem;
-
- @include media(xxsmall) {
- padding-right: 1rem;
- padding-left: 1rem;
- }
- }
-
- .sign-out-all {
- margin-bottom: -1em;
- }
-}
diff --git a/packages/clerk-js/src/ui/styles/_userprofile.scss b/packages/clerk-js/src/ui/styles/_userprofile.scss
deleted file mode 100644
index ca47b864b36..00000000000
--- a/packages/clerk-js/src/ui/styles/_userprofile.scss
+++ /dev/null
@@ -1,448 +0,0 @@
-$min-width: 320px;
-$content-width-xl: 840px;
-$content-width-lg: 620px;
-
-&.user-profile {
- display: flex;
- min-width: 320px;
- background-color: $theme-accounts-background-color;
-
- .navbar {
- display: flex;
- margin-top: 3rem;
- list-style: none;
- flex-direction: column;
- }
-
- .navbar-link {
- display: inline-block;
- border-left: 4px solid #e5e5e5;
- width: 300px;
- // Border radius should be more than the max navbar-link height
- // in order to achieve the desired rounder corner effect.
- // $theme-border-radius can be 1em (normal) or 0.5em (compact)
- // We use a high enough value to support arbitrary link heights
- // even with "Spacing" set to "compact"
- border-radius: 0 calc(#{$theme-border-radius} * 999) calc(#{$theme-border-radius} * 999) 0;
- padding: themed-padding(1rem 2rem);
- color: $cl-gray-light-3;
- font-weight: $semibold-weight;
- @include text-ellipsis;
-
- &.active {
- color: $theme-primary;
- background-color: $theme-primary-l2;
- border-left: 4px solid $theme-primary;
- }
-
- > .icon {
- position: relative;
- margin-right: 0.5rem;
- bottom: 2px;
- }
-
- svg {
- width: 24px;
- height: 24px;
- }
- }
-
- .main {
- min-width: 320px;
- width: $content-width-xl;
- margin: 3em auto 0 auto;
- padding-bottom: 1.5em;
-
- @include media(upto large) {
- width: $content-width-lg;
- }
-
- @include media(upto small) {
- margin: 1.5em 1em 0;
- width: auto;
- }
-
- .spinner {
- border: 3px solid var(--clerk-primary);
- border-right-color: transparent;
- width: 26px;
- height: 26px;
- border-radius: (26px / 2);
- position: absolute;
- top: 50%;
- right: 50%;
- transform: translate(0, -50%);
- }
- }
-
- @include media(upto medium) {
- flex-direction: column;
-
- .navbar {
- margin-top: 0;
- flex-direction: row;
- min-height: 3em;
- }
-
- .navbar-link {
- padding: themed-padding(0.75rem 2rem);
- width: auto;
- flex-grow: 1;
- border-left: none;
- border-bottom: 4px solid #e5e5e5;
- //border-radius: 12px 12px 0 0;
- border-radius: calc(#{$theme-border-radius} * 1.5) calc(#{$theme-border-radius} * 1.5) 0 0;
- text-align: center;
-
- > .icon {
- width: 1em;
- height: 1.125em;
- }
-
- &.active {
- color: $theme-primary;
- background-color: $theme-primary-l2;
- border-left: none;
- border-bottom: 4px solid $theme-primary;
- }
- }
- }
-
- .image {
- justify-content: flex-start;
- border-radius: 50%;
- height: 64px;
- width: 64px;
- color: $themed-font-color-l1;
- }
-
- .left-icon-wrapper {
- margin-right: 10px;
- height: 1.5rem;
- }
-}
-
-.themed-card + .powered-by-clerk {
- margin-top: 1.5em;
-}
-
-.titled-card-list {
- margin: 0 -2em;
-
- @include media(upto small) {
- margin: 0 -1.5em;
- }
-}
-
-// New, extract into module during the refactor
-.list-item {
- padding-left: 2em;
-
- @include media(upto small) {
- padding-left: 1.5em;
- }
-
- @include media(xxsmall) {
- padding: 2em 1em;
- }
-
- .list-item-entry div:not(:last-of-type) {
- margin-bottom: 0.5rem;
- }
-
- .list-item-subtitle {
- margin-top: 0.2em;
- font-size: 0.875em;
- color: $cl-gray-light-3;
- }
-}
-
-.phone-item,
-.email-item {
- display: flex;
- flex-wrap: wrap;
- @include text-ellipsis;
- @include media(upto xsmall) {
- display: block;
- }
-}
-
-.tags {
- margin-left: 0.375rem;
-
- .tag {
- margin-right: 0;
- }
-
- @include media(upto xsmall) {
- margin-left: 0;
- .tag {
- margin: 0.375em 0.375em 0 0;
- }
- }
-}
-
-.phone-item {
- font-weight: $semibold-weight;
-}
-
-.ident-detail {
- font-size: 1.25em;
- font-weight: $semibold-weight;
- @include text-ellipsis;
- display: flex;
- flex-wrap: wrap;
- @include media(upto xsmall) {
- display: block;
- }
-}
-
-.connection-info {
- font-size: 0.875em;
- color: $cl-gray-light-3;
- margin-top: 0.25em;
- flex-basis: 100%;
-}
-
-.list-card {
- padding: 1.5em 0;
-
- .empty-list-item {
- padding: 3em 0;
- text-align: center;
- }
-}
-
-.empty-list-item {
- color: $themed-font-color-l1;
-}
-
-.list-card .add-resource-button {
- width: 100%;
- margin: 1em 0 -1.5em 0;
- padding: themed-padding(1.5em 0em 1.5em 2em);
- font-weight: $semibold-weight;
- display: flex;
- justify-content: flex-start;
- border-radius: 0 !important;
-}
-
-.remove-button {
- padding: 0;
-
- svg {
- margin-right: 0.625em;
- }
-}
-
-.primary-status-container {
- display: flex;
- justify-content: space-between;
-
- .description {
- display: flex;
-
- svg {
- color: $cl-gray-light-3;
- width: 1.5em;
- height: 1.5em;
- margin-right: 1em;
- flex-shrink: 0;
- }
- }
-
- .text {
- font-size: 1em;
- white-space: initial;
- }
-
- .text .title {
- font-weight: $semibold-weight;
- }
-
- .text .subtitle {
- font-size: 0.925em;
- }
-}
-
-.verifiable-field-card {
- form {
- margin: 3em 0 0 0;
- max-width: unset;
- }
-
- .copy-text {
- margin: 0.5rem 0 1rem 0;
- line-height: 1.25rem;
-
- .tip {
- margin: 1rem 0 0 0;
- font-size: 0.875rem;
- color: $themed-font-color-l1;
- }
- }
-
- .identifier {
- font-weight: $semibold-weight;
- }
-
- .verify-email-container {
- margin-top: 1rem;
- margin-right: -2rem;
- width: unset; // account for List.Item margin
- }
-}
-
-.two-step-verification {
- padding: 3em 2em;
-
- .phone-select .phone-select-row {
- padding: 1em 1em 1em 0;
- border-radius: $theme-border-radius;
-
- &:hover {
- cursor: pointer;
- }
- }
-
- .add-phone {
- margin-top: 0.625em;
- }
-
- .message {
- margin: 2em 0 3em 0;
- }
-}
-
-.form-button-group {
- display: flex;
- flex-direction: row-reverse;
- justify-content: flex-start;
- margin-top: 2em;
-
- & button:last-of-type {
- margin-right: 1em;
- }
-
- & button:only-child {
- margin-right: 0;
- }
-
- button {
- border-radius: $theme-border-radius;
- }
-}
-
-.editable-field {
- form {
- max-width: unset;
- }
-}
-
-.link-button {
- margin-top: 0.25em;
- padding: 0;
-}
-
-.page-heading {
- display: flex;
- margin-bottom: 2.625em;
-
- .back-button {
- margin-right: 0.625em;
- }
-
- .title {
- font-size: 2.5em;
- font-weight: $semibold-weight;
- }
-
- .subtitle {
- font-weight: $font-weight-normal;
- font-size: 1.25em;
- color: $cl-gray-light-3;
- margin: 0;
- }
-
- @include media(upto small) {
- .title {
- font-size: 1.75em;
- margin: 0;
- }
-
- .subtitle {
- font-size: 1em;
- }
- }
-}
-
-// devices and activity components
-.activity-icon {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
-
- @include media(upto xsmall) {
- display: none;
- }
-
- svg {
- margin-top: -1.5rem;
- }
-
- &.activity-icon-desktop svg {
- width: 7rem;
- height: 4rem;
- }
-
- &.activity-icon-mobile svg {
- width: 2rem;
- height: 4rem;
- }
-}
-
-.activity-description {
- .activity-prop {
- color: $themed-font-color-l1;
- margin: 0 0 0.025rem 0;
- line-height: normal;
- @include text-ellipsis;
- }
-
- .activity-type {
- position: relative;
- color: $themed-font-color;
- font-weight: $semibold-weight;
- margin: 0 0 0.125rem 0;
- overflow: visible;
- }
-
- .tag {
- position: absolute;
- padding-top: 0.125rem;
- padding-bottom: 0.125rem;
- }
-
- .activity-last-active-at {
- font-size: 0.875rem;
- }
-
- .activity-last-active-at {
- text-transform: none;
-
- &:first-letter {
- text-transform: uppercase;
- }
- }
-}
-
-.phone-input-container {
- max-width: 278px;
-}
-
-.verification-error {
- color: var(--clerk-font-color-l1);
- font-size: 0.875rem;
-}
diff --git a/packages/clerk-js/src/ui/styles/_verifyMagicLink.scss b/packages/clerk-js/src/ui/styles/_verifyMagicLink.scss
deleted file mode 100644
index 0917b37c1f7..00000000000
--- a/packages/clerk-js/src/ui/styles/_verifyMagicLink.scss
+++ /dev/null
@@ -1,168 +0,0 @@
-.auth-form-body-center {
- align-items: center;
-}
-
-.verification-page-container {
- text-align: center;
-}
-
-.verification-page-text {
- text-align: center;
- max-width: 21rem;
- margin: 0.5rem 0 1rem 0;
- color: $cl-gray-light-3;
- font-weight: $normal-weight;
- font-family: $theme-font-family;
-}
-
-.verification-page-container {
- width: 100%;
- flex-direction: column;
- display: flex;
- align-items: center;
-}
-
-.verification-page-icon-container {
- width: 6rem;
- height: 6rem;
- border-radius: 50%;
- background-color: $gray08;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-bottom: 1rem;
-}
-
-.verification-page-email-icon {
- color: $theme-primary;
- height: 1.5625rem;
- width: 1.5625rem;
-}
-
-.verification-page-header {
- font-size: 1.25rem;
- font-weight: $semibold-weight;
- margin: 1rem 0;
-}
-
-.verification-page-identifier {
- font-size: 1rem;
- color: $cl-black;
- font-weight: $semibold-weight;
-}
-
-.verify-page-container {
- z-index: 2147483647;
- position: fixed;
- top: 0;
- left: 0;
- min-height: 100%;
- min-width: 100%;
- background-color: unset;
-}
-
-.verify-page-backdrop {
- position: absolute;
- top: 0;
- left: 0;
- height: 100%;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
-
- animation: blurFadeIn 0.7s forwards;
-}
-
-.verify-page-modal {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- @include media(upto small) {
- width: 90%;
- padding: 3rem 1.5rem;
- }
- @include media(from small) {
- border-radius: $theme-border-radius;
- width: 480px;
- margin: 0 auto;
- padding: 3rem 2rem;
- }
- animation: fadeIn 0.25s forwards;
-}
-
-.verify-page-soft-text {
- color: $gray40;
-}
-
-.verification-page-email-icon {
- color: $theme-primary;
- height: 1.3625rem;
- width: 1.3625rem;
-}
-
-.verification-page-guard-icon {
- color: $success;
- height: 1.4625rem;
- width: 1.4625rem;
-}
-
-.verification-page-warning-icon {
- color: $error;
- height: 1.3625rem;
- width: 1.3625rem;
-}
-
-.verification-page-switch-icon {
- color: $theme-primary;
- height: 1.3625rem;
- width: 1.3625rem;
-}
-
-.verify-page-content {
- position: relative;
-}
-
-.verify-page-spinner {
- width: 2rem;
- height: 2rem;
- border: 4px solid $themed-primary;
- border-left-color: transparent;
-}
-
-.verify-page-powered-by-clerk {
- margin-top: 4.5rem;
-}
-
-.verify-page-resend-button {
- margin-top: 0.5rem;
- min-height: 1.6em;
- padding-top: 0;
- padding-bottom: 0;
- text-align: center;
- color: $themed-primary;
- font-weight: $semibold-weight;
-}
-
-@keyframes blurFadeIn {
- 0% {
- backdrop-filter: blur(0px);
- background-color: rgba(255, 255, 255, 0);
- }
-
- 100% {
- backdrop-filter: blur(10px);
- background-color: rgba(255, 255, 255, 1);
- }
-}
-
-@keyframes fadeIn {
- 0% {
- opacity: 0;
- }
-
- 100% {
- opacity: 1;
- }
-}
diff --git a/packages/clerk-js/src/ui/styles/clerk.scss b/packages/clerk-js/src/ui/styles/clerk.scss
deleted file mode 100644
index 141e13ca5cb..00000000000
--- a/packages/clerk-js/src/ui/styles/clerk.scss
+++ /dev/null
@@ -1,89 +0,0 @@
-@import '../../../../shared/components/styles/variables';
-@import '../../../../shared/components/styles/mixins';
-
-// postcss is responsible for adding a cl- prefix to all declarations
-// Look at the webpack config for how that happens
-
-$cl-box-shadow-lg: 0px 10px 20px rgba(60, 60, 60, 0.1);
-$cl-black: #000000;
-$cl-gray: #4e4e4e;
-$cl-gray-light-1: #eeeeee;
-$cl-gray-light-2: #828282;
-$cl-gray-light-3: $themed-font-color-l1;
-$cl-gray-light-4: #757575;
-$cl-red: rgba(205, 68, 74, 1);
-$cl-red-O10: rgba(205, 68, 74, 0.1);
-
-// Scope everything to cl-mount-node
-.component {
- @import '../../../../shared/components/styles/variables';
- @import '../../../../shared/components/styles/breakpoints';
- @import '../../../../shared/components/styles/themed_mixins';
- @import '../../../../shared/components/styles/mixins';
-
- @import 'injections';
- @import 'custom_reboot';
- @import 'sharedComponentsOverwrites';
- @import 'shared/fonts';
- @import 'shared/logo';
- @import 'shared/poweredByClerk';
- @import 'theme';
- @import 'authForms';
- @import 'backButton';
- @import 'alert';
- @import 'userprofile';
- @import 'userbutton';
- @import 'backButton';
- @import 'activeAccountsManager';
- @import 'signInAccountSwitcher';
- @import 'verifyMagicLink';
-
- font-family: $theme-font-family;
-
- *,
- *:before,
- *:after {
- box-sizing: inherit;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
-
- :focus:not(:focus-visible) {
- outline: none !important;
- }
-
- :focus-visible {
- @include outline();
- }
-
- fieldset {
- border: none;
- }
-}
-
-.modal-backdrop {
- position: fixed;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- background-color: rgba(0, 0, 0, 0.2);
- z-index: $high-z-index;
-}
-
-.modal-container {
- padding: 0.5rem;
- display: flex;
- max-width: 100%;
- max-height: 100%;
- height: 100%;
- width: 100%;
- z-index: $high-z-index;
- border-radius: 0;
- background-color: rgba(0, 0, 0, 0.2);
-
- .sign-in,
- .sign-up {
- margin: 0;
- }
-}
\ No newline at end of file
diff --git a/packages/clerk-js/src/ui/styles/shared/_fonts.scss b/packages/clerk-js/src/ui/styles/shared/_fonts.scss
deleted file mode 100644
index 033d28df5d2..00000000000
--- a/packages/clerk-js/src/ui/styles/shared/_fonts.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-$font-size-base: 1rem; // Assumes the browser default, typically `16px`
-
-$font-size-lg: $font-size-base * 1.25;
-$font-size-sm: $font-size-base * 0.875;
-$font-size-xs: $font-size-base * 0.75;
-
-$semibold-weight: 600;
-
-.font-semibold {
- font-weight: $semibold-weight;
-}
diff --git a/packages/clerk-js/src/ui/styles/shared/_logo.scss b/packages/clerk-js/src/ui/styles/shared/_logo.scss
deleted file mode 100644
index ad0e81637ae..00000000000
--- a/packages/clerk-js/src/ui/styles/shared/_logo.scss
+++ /dev/null
@@ -1,20 +0,0 @@
-.logo {
- display: block;
- width: 100%;
-
- margin: 0 auto;
- padding: 0;
- text-align: center;
- white-space: nowrap;
-
- font-size: 3rem;
- line-height: 3rem;
- height: 3rem;
-
- color: $theme-primary;
-
- > img {
- height: 100%;
- vertical-align: initial;
- }
-}
diff --git a/packages/clerk-js/src/ui/styles/shared/_poweredByClerk.scss b/packages/clerk-js/src/ui/styles/shared/_poweredByClerk.scss
deleted file mode 100644
index 3b42aa81e34..00000000000
--- a/packages/clerk-js/src/ui/styles/shared/_poweredByClerk.scss
+++ /dev/null
@@ -1,17 +0,0 @@
-.powered-by-clerk-container {
- display: flex;
- justify-content: center;
- color: $themed-font-color;
-
- span {
- opacity: 0.3;
- font-size: $font-size-xs;
- }
-
- .powered-by-clerk-logo {
- opacity: 0.2;
- margin-left: 4px;
- margin-top: -5px;
- color: $themed-font-color;
- }
-}
diff --git a/packages/clerk-js/src/ui/userButton/Salutation.test.tsx b/packages/clerk-js/src/ui/userButton/Salutation.test.tsx
deleted file mode 100644
index 9d3bfa8bd14..00000000000
--- a/packages/clerk-js/src/ui/userButton/Salutation.test.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { UserResource } from '@clerk/types';
-import React from 'react';
-
-import { Salutation } from './Salutation';
-
-describe('Salutation', () => {
- const user = {
- firstName: 'Jane',
- lastName: 'Doe',
- } as UserResource;
-
- it('renders Salutation', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userButton/Salutation.tsx b/packages/clerk-js/src/ui/userButton/Salutation.tsx
deleted file mode 100644
index cebbd465964..00000000000
--- a/packages/clerk-js/src/ui/userButton/Salutation.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { UserResource } from '@clerk/types';
-import React from 'react';
-
-import { determineIdentifier } from './utils';
-
-type SalutationProps = {
- user: UserResource;
-};
-
-export const Salutation = ({ user }: SalutationProps): JSX.Element => {
- return (
-
- {user.firstName || user.username ? `Hi, ${user.firstName || user.username}!` : determineIdentifier(user)}
-
- );
-};
diff --git a/packages/clerk-js/src/ui/userButton/UserButton.test.tsx b/packages/clerk-js/src/ui/userButton/UserButton.test.tsx
deleted file mode 100644
index 0b20f907761..00000000000
--- a/packages/clerk-js/src/ui/userButton/UserButton.test.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { UserResource } from '@clerk/types';
-import React from 'react';
-import ReactDOM from 'react-dom';
-
-import { UserButton } from './UserButton';
-
-jest.mock('ui/contexts', () => {
- return {
- useCoreSessionList: () => {
- return [
- {
- id: 'deadbeef',
- user: {
- firstName: 'John',
- lastName: 'Doe',
- profileImageUrl: 'http://test.host/profile.png',
- primaryEmailAddress: 'jdoe@example.com',
- },
- },
- ];
- },
- useCoreClerk: () => {
- return {
- setSession: jest.fn(),
- signOut: jest.fn(),
- signOutOne: jest.fn(),
- };
- },
- withCoreUserGuard: (a: any) => a,
- useCoreSession: () => {
- return {
- id: 'deadbeef',
- user: {
- firstName: 'John',
- lastName: 'Doe',
- profileImageUrl: 'http://test.host/profile.png',
- primaryEmailAddress: 'jdoe@example.com',
- },
- };
- },
- useCoreUser: () => {
- return {
- firstName: 'John',
- lastName: 'Doe',
- } as UserResource;
- },
- useEnvironment: jest.fn(() => ({
- authConfig: {},
- displayConfig: { branded: false },
- })),
- useUserButtonContext: () => {
- return {
- useUserButtonContext: jest.fn(() => ({
- navigateAfterMultiSessionSingleSignOut: jest.fn(),
- navigateAfterSignOut: jest.fn(),
- navigateAfterSwitchSession: jest.fn(),
- userProfileURL: 'http://test.host/profile',
- signInUrl: 'http://test.host/signin',
- })),
- };
- },
- };
-});
-
-describe('UserButton', () => {
- beforeAll(() => {
- //@ts-ignore
- ReactDOM.createPortal = node => node;
- });
-
- it('renders the user button', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders the user button with name', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userButton/UserButton.tsx b/packages/clerk-js/src/ui/userButton/UserButton.tsx
deleted file mode 100644
index 005c738ecd0..00000000000
--- a/packages/clerk-js/src/ui/userButton/UserButton.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { Avatar } from '@clerk/shared/components/avatar';
-import { Portal } from '@clerk/shared/components/portal';
-import { useDetectClickOutside } from '@clerk/shared/hooks';
-import type { UserButtonProps } from '@clerk/types';
-import cn from 'classnames';
-import React from 'react';
-import { usePopper } from 'react-popper';
-import { useCoreUser, withCoreUserGuard } from 'ui/contexts';
-
-import { PopupVisibilityContext } from './contexts/PopupVisibilityContext';
-import { UserButtonPopup } from './UserButtonPopup';
-import { determineIdentifier } from './utils';
-
-const userButtonPopperOptions = {
- placement: 'bottom-end',
- modifiers: [
- {
- name: 'offset',
- options: {
- offset: [0, 16],
- },
- },
- ],
-};
-
-export const UserButton = withCoreUserGuard(({ showName }: UserButtonProps) => {
- const user = useCoreUser();
- const { firstName, lastName, profileImageUrl } = user;
- const identifier = determineIdentifier(user);
-
- const userButtonRef = React.useRef(null);
- const containerRef = React.useRef(null);
- const { isActive, setIsActive } = useDetectClickOutside(containerRef, false);
- const { styles, attributes, update } = usePopper(
- userButtonRef.current,
- containerRef.current,
- userButtonPopperOptions as any,
- );
-
- React.useLayoutEffect(() => {
- void update?.();
- }, [isActive]);
-
- const handlePopupToggle = (e: any) => {
- if (e.button !== leftMouseButton) {
- return;
- }
- e.stopPropagation();
- setIsActive(!isActive);
- };
-
- return (
- <>
-
-
- {showName && {identifier}
}
-
-
-
-
-
-
-
-
- >
- );
-});
-
-const leftMouseButton = 0;
diff --git a/packages/clerk-js/src/ui/userButton/UserButtonPopup.test.tsx b/packages/clerk-js/src/ui/userButton/UserButtonPopup.test.tsx
deleted file mode 100644
index 96a66963d4e..00000000000
--- a/packages/clerk-js/src/ui/userButton/UserButtonPopup.test.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { SessionResource, UserResource } from '@clerk/types';
-import React from 'react';
-
-import { UserButtonPopup } from './UserButtonPopup';
-
-const defaultSessions = [
- {
- id: 'deadbeef',
- publicUserData: {
- firstName: 'John',
- lastName: 'Doe',
- profileImageUrl: 'http://test.host/profile.png',
- primaryEmailAddress: 'jdoe@example.com',
- },
- status: 'active',
- },
- {
- id: 'cafebabe',
- publicUserData: {
- firstName: 'Carla',
- lastName: 'Coe',
- profileImageUrl: 'http://test.host/profile.png',
- primaryEmailAddress: 'ccoe@example.com',
- },
- status: 'active',
- },
-] as any as SessionResource[];
-
-let singleSessionMode = true;
-let sessions: SessionResource[] = [];
-
-jest.mock('ui/contexts', () => {
- return {
- useCoreSessionList: () => {
- return sessions;
- },
- useCoreClerk: () => {
- return {
- setActive: jest.fn(),
- signOut: jest.fn(),
- signOutOne: jest.fn(),
- };
- },
- withCoreUserGuard: (a: any) => a,
- useCoreSession: () => {
- return {
- id: 'deadbeef',
- user: {
- firstName: 'John',
- lastName: 'Doe',
- profileImageUrl: 'https://images.clerktest.host/profile.png',
- primaryEmailAddress: 'jdoe@example.com',
- },
- };
- },
- useCoreUser: () => {
- return {
- firstName: 'John',
- lastName: 'Doe',
- } as UserResource;
- },
- useEnvironment: jest.fn(() => ({
- authConfig: {
- singleSessionMode,
- },
- displayConfig: {
- branded: false,
- },
- })),
- useUserButtonContext: jest.fn(() => ({
- navigateAfterMultiSessionSingleSignOut: jest.fn(),
- navigateAfterSignOut: jest.fn(),
- navigateAfterSwitchSession: jest.fn(),
- userProfileURL: 'http://test.host/profile',
- signInUrl: 'http://test.host/signin',
- })),
- };
-});
-
-describe('UserButtonPopup', () => {
- describe('multi session mode', () => {
- beforeEach(() => {
- singleSessionMode = false;
- sessions = defaultSessions;
- });
-
- it('renders the popup with all the available sessions', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
- });
-
- describe('single session mode', () => {
- beforeEach(() => {
- singleSessionMode = true;
- sessions = defaultSessions;
- });
-
- it('renders the popup with all the available sessions', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('only renders active sessions', () => {
- sessions[sessions.length - 1].status = 'expired';
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
- });
-});
diff --git a/packages/clerk-js/src/ui/userButton/UserButtonPopup.tsx b/packages/clerk-js/src/ui/userButton/UserButtonPopup.tsx
deleted file mode 100644
index d48652bd089..00000000000
--- a/packages/clerk-js/src/ui/userButton/UserButtonPopup.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { Avatar } from '@clerk/shared/components/avatar';
-import React from 'react';
-import { ActiveAccountsManager } from 'ui/common/activeAccountsManager/ActiveAccountsManager';
-import { useCoreSession, useCoreSessionList, useCoreUser, useUserButtonContext, withCoreUserGuard } from 'ui/contexts';
-
-import { Salutation } from './Salutation';
-
-function UserButtonPopupBase(): JSX.Element | null {
- const sessions = useCoreSessionList();
- const session = useCoreSession();
- const user = useCoreUser();
- const userButtonContext = useUserButtonContext();
-
- const otherSessions = sessions.filter(({ id }) => id !== session.id).filter(s => s.status === 'active');
-
- return (
- <>
-
-
-
-
{user.primaryEmailAddress?.toString()}
-
-
- >
- );
-}
-UserButtonPopupBase.displayName = 'UserButtonPopup';
-
-export const UserButtonPopup = withCoreUserGuard(UserButtonPopupBase);
diff --git a/packages/clerk-js/src/ui/userButton/__snapshots__/Salutation.test.tsx.snap b/packages/clerk-js/src/ui/userButton/__snapshots__/Salutation.test.tsx.snap
deleted file mode 100644
index d17b24dad33..00000000000
--- a/packages/clerk-js/src/ui/userButton/__snapshots__/Salutation.test.tsx.snap
+++ /dev/null
@@ -1,9 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Salutation renders Salutation 1`] = `
-
- Hi, Jane!
-
-`;
diff --git a/packages/clerk-js/src/ui/userButton/__snapshots__/UserButton.test.tsx.snap b/packages/clerk-js/src/ui/userButton/__snapshots__/UserButton.test.tsx.snap
deleted file mode 100644
index 6e39d0506ec..00000000000
--- a/packages/clerk-js/src/ui/userButton/__snapshots__/UserButton.test.tsx.snap
+++ /dev/null
@@ -1,330 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`UserButton renders the user button 1`] = `
-Array [
-
-
-
- John Doe
-
-
-
- JD
-
-
- ,
-
-
-
-
- John Doe
-
-
-
- JD
-
-
-
- Hi, John!
-
-
-
-
-
-
-
- Manage account
-
-
-
- Sign out
-
-
-
-
-
-
-
-
- Add account
-
-
-
-
-
,
-]
-`;
-
-exports[`UserButton renders the user button with name 1`] = `
-Array [
-
-
-
- John Doe
-
-
-
- JD
-
-
-
- John Doe
-
- ,
-
-
-
-
- John Doe
-
-
-
- JD
-
-
-
- Hi, John!
-
-
-
-
-
-
-
- Manage account
-
-
-
- Sign out
-
-
-
-
-
-
-
-
- Add account
-
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userButton/__snapshots__/UserButtonPopup.test.tsx.snap b/packages/clerk-js/src/ui/userButton/__snapshots__/UserButtonPopup.test.tsx.snap
deleted file mode 100644
index b83faf5bf23..00000000000
--- a/packages/clerk-js/src/ui/userButton/__snapshots__/UserButtonPopup.test.tsx.snap
+++ /dev/null
@@ -1,420 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`UserButtonPopup multi session mode renders the popup with all the available sessions 1`] = `
-Array [
-
-
-
- John Doe
-
-
-
- JD
-
-
-
- Hi, John!
-
-
-
,
-
-
-
-
- Manage account
-
-
-
- Sign out
-
-
-
-
-
-
- Carla Coe
-
-
-
- CC
-
-
-
-
- Carla
-
- Coe
-
-
-
-
-
-
-
-
-
- Add account
-
-
-
-
-
-
- Sign out of all accounts
-
-
-
,
-]
-`;
-
-exports[`UserButtonPopup single session mode only renders active sessions 1`] = `
-Array [
-
-
-
- John Doe
-
-
-
- JD
-
-
-
- Hi, John!
-
-
-
,
-
-
-
-
- Manage account
-
-
-
- Sign out
-
-
-
,
-]
-`;
-
-exports[`UserButtonPopup single session mode renders the popup with all the available sessions 1`] = `
-Array [
-
-
-
- John Doe
-
-
-
- JD
-
-
-
- Hi, John!
-
-
-
,
-
-
-
-
- Manage account
-
-
-
- Sign out
-
-
-
-
-
-
- Carla Coe
-
-
-
- CC
-
-
-
-
- Carla
-
- Coe
-
-
-
-
-
-
-
-
- Sign out of all accounts
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userButton/contexts/PopupVisibilityContext.ts b/packages/clerk-js/src/ui/userButton/contexts/PopupVisibilityContext.ts
deleted file mode 100644
index ecbdd6fc6a6..00000000000
--- a/packages/clerk-js/src/ui/userButton/contexts/PopupVisibilityContext.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { noop } from '@clerk/shared/utils';
-import React from 'react';
-
-type PopupVisibility = {
- isPopupVisible: boolean;
- setPopupVisible: (visibility: boolean) => void;
-};
-
-export const PopupVisibilityContext = React.createContext({
- isPopupVisible: false,
- setPopupVisible: noop,
-});
-
-export const useUserButtonPopupVisibility = () => React.useContext(PopupVisibilityContext);
diff --git a/packages/clerk-js/src/ui/userButton/utils.test.ts b/packages/clerk-js/src/ui/userButton/utils.test.ts
deleted file mode 100644
index 1aebf93f2ad..00000000000
--- a/packages/clerk-js/src/ui/userButton/utils.test.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { UserResource } from '@clerk/types';
-
-import { determineIdentifier } from './utils';
-
-describe('UserButton utils', () => {
- describe('determineIdentifier(user)', () => {
- it('returns greeting if user has first name, username or primary phone number', () => {
- let user = {
- firstName: 'Joe',
- } as UserResource;
- expect(determineIdentifier(user)).toBe('Joe');
-
- user = {
- username: 'Joe',
- } as UserResource;
- expect(determineIdentifier(user)).toBe('Joe');
-
- user = {
- primaryEmailAddress: {
- emailAddress: 'joe@example.com',
- },
- } as UserResource;
- expect(determineIdentifier(user)).toBe('joe@example.com');
-
- user = {
- primaryPhoneNumber: {
- phoneNumber: '+1234567890',
- },
- } as UserResource;
- expect(determineIdentifier(user)).toBe('+1234567890');
- });
- });
-});
diff --git a/packages/clerk-js/src/ui/userButton/utils.ts b/packages/clerk-js/src/ui/userButton/utils.ts
deleted file mode 100644
index cf881c77f28..00000000000
--- a/packages/clerk-js/src/ui/userButton/utils.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { titleize } from '@clerk/shared/utils/string';
-import { UserResource } from '@clerk/types';
-
-export function determineIdentifier(user: UserResource): string {
- if (user.firstName || user.lastName) {
- return [titleize(user.firstName), titleize(user.lastName)].join(' ').trim();
- }
-
- if (user.username) {
- return user.username;
- }
-
- if (user.primaryEmailAddress) {
- return user.primaryEmailAddress.emailAddress;
- }
-
- if (user.primaryPhoneNumber) {
- return user.primaryPhoneNumber.phoneNumber;
- }
-
- if (user.primaryWeb3Wallet) {
- return user.primaryWeb3Wallet.web3Wallet;
- }
-
- return '';
-}
diff --git a/packages/clerk-js/src/ui/userProfile/AddVerifiableField.tsx b/packages/clerk-js/src/ui/userProfile/AddVerifiableField.tsx
deleted file mode 100644
index df14dc1d389..00000000000
--- a/packages/clerk-js/src/ui/userProfile/AddVerifiableField.tsx
+++ /dev/null
@@ -1,208 +0,0 @@
-import { Button } from '@clerk/shared/components/button';
-import { Control } from '@clerk/shared/components/control';
-import { Form } from '@clerk/shared/components/form';
-import { InputWithIcon } from '@clerk/shared/components/input';
-import { OneTimeCodeInput, VerifyCodeHandler } from '@clerk/shared/components/oneTimeCodeInput';
-import { PhoneInput, PhoneViewer } from '@clerk/shared/components/phoneInput';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { Wizard } from '@clerk/shared/components/wizard';
-import { VerificationResource } from '@clerk/types';
-import React from 'react';
-import { handleError, useFieldState, verificationErrorMessage } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useNavigate } from 'ui/hooks';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-export interface ListValue {
- id: string;
- verification: VerificationResource | null;
- toString: () => string;
- destroy: () => Promise;
- prepareVerification: () => Promise;
- attemptVerification: (params: { code: string }) => Promise;
-}
-
-interface AddVerifiableFieldProps {
- type: 'email' | 'phone';
- label: string;
- inputIcon?: React.ReactNode;
- stepTitle: Record;
- stepText: Record;
- slug: string;
- onAdd: (value: string) => Promise;
-}
-
-export function AddVerifiableField({
- label,
- slug,
- onAdd,
- stepText,
- stepTitle,
- inputIcon,
- type,
-}: AddVerifiableFieldProps): JSX.Element {
- const inputName = `${label.replace(/\s/g, '_').toLowerCase()}_input`;
- const [state, setState] = React.useState<{
- step: number;
- listVal: ListValue | null;
- }>({
- listVal: null,
- step: 0,
- });
- const currentValue = useFieldState(slug, '');
- const code = useFieldState('code', '');
- const [error, setError] = React.useState();
- const { navigate } = useNavigate();
-
- React.useEffect(() => {
- currentValue.setError(undefined);
- setError(undefined);
- }, [currentValue.value]);
-
- const updateFieldSubmit = async (e: React.FormEvent) => {
- e.preventDefault();
- try {
- const listVal = await onAdd(currentValue.value);
- await listVal.prepareVerification();
- setState(currentState => ({ ...currentState, listVal, step: 1 }));
- } catch (err) {
- handleError(err, [currentValue], setError);
- }
- };
-
- const sendVerificationCode = () => {
- if (!state.listVal) {
- return;
- }
- // state.listVal.prepareVerification();
- };
-
- const verifyCode: VerifyCodeHandler = async (verify, reject) => {
- try {
- await state.listVal?.attemptVerification({ code: code.value });
- verify(() => setState(s => ({ ...s, step: s.step + 1 })));
- } catch (err) {
- reject(verificationErrorMessage(err));
- }
- };
-
- const onFinish = () => {
- if (!state.listVal) {
- return;
- }
- navigate(`../${state.listVal.id}`);
- };
-
- const onBack = () => navigate('../');
-
- const step1EnterValue = (
-
- );
-
- const step2Verify = (
- <>
-
- {stepText[state.step] + ' '}
- {type === 'phone' ? (
-
- ) : (
-
{currentValue.value}
- )}
- .
-
-
- >
- );
-
- const step3Finish = (
- <>
-
- {type === 'phone' ? (
-
- ) : (
-
{currentValue.value}
- )}{' '}
- {stepText[state.step]}
-
-
- Finish
-
- >
- );
-
- return (
- <>
-
-
- {error}
-
-
- {step1EnterValue}
- {step2Verify}
- {step3Finish}
-
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/EditableField.tsx b/packages/clerk-js/src/ui/userProfile/EditableField.tsx
deleted file mode 100644
index 2971d5bf9d3..00000000000
--- a/packages/clerk-js/src/ui/userProfile/EditableField.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { Control } from '@clerk/shared/components/control';
-import { Form } from '@clerk/shared/components/form';
-import { Input } from '@clerk/shared/components/input';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import React from 'react';
-import { handleError, useFieldState } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-interface EditableFieldProps {
- label: string;
- slug: string;
- value?: string | null;
-}
-
-export const EditableField = (props: EditableFieldProps) => {
- const user = useCoreUser();
- const { label, slug, value } = props;
-
- // @ts-ignore
- const currentValue = useFieldState(slug, user[value] ? user[value] : '');
- const [error, setError] = React.useState();
-
- const { navigate } = useNavigate();
-
- const updateFieldSubmit = async (e: React.FormEvent) => {
- e.preventDefault();
- try {
- await user.update({ [currentValue.name]: currentValue.value });
- navigate('../');
- } catch (err) {
- handleError(err, [currentValue], setError);
- }
- };
-
- const handleCancel = () => {
- navigate('../');
- };
-
- const inputName = `${slug}_input`;
-
- return (
- <>
-
-
- {error}
-
-
-
- >
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/EditableListFieldRemoveCard.tsx b/packages/clerk-js/src/ui/userProfile/EditableListFieldRemoveCard.tsx
deleted file mode 100644
index ae5b1070a37..00000000000
--- a/packages/clerk-js/src/ui/userProfile/EditableListFieldRemoveCard.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-import { Button } from '@clerk/shared/components/button';
-import { PhoneViewer } from '@clerk/shared/components/phoneInput';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import React from 'react';
-import { handleError } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-
-interface EditableListFieldRemoveCardProps {
- type: 'phone' | 'email' | 'social_account' | 'web3_wallet';
- label: string;
- buttonLabel: string;
- onCancel: () => void;
- onRemove: () => Promise;
- onRemoved?: () => void;
-}
-
-export const EditableListFieldRemoveCard: React.FC = ({
- type,
- label,
- buttonLabel,
- onCancel,
- onRemove,
- onRemoved,
-}) => {
- const [error, setError] = React.useState();
-
- const updateFieldSubmit = async () => {
- try {
- await onRemove();
- if (typeof onRemoved === 'function') {
- await onRemoved();
- }
- } catch (err) {
- handleError(err, [], setError);
- }
- };
-
- const formattedType = type.split('_').join(' ');
-
- return (
-
- {error}
-
-
-
- {type === 'phone' ? (
-
- ) : (
- {label}
- )}{' '}
- will be removed from this account.
-
- {type === 'email' && (
-
- You’ll no longer receive communications to this email address, and you cannot use it when signing in to
- identify yourself.
-
- )}
- {type === 'phone' && (
-
- You will no longer receive messages to this number, and you cannot use it when signing in to identify
- yourself.
-
- )}
- {type === 'social_account' &&
Unlink your {label} account, and remove associated personal information.
}
- {type === 'web3_wallet' &&
Remove the connection between this app and your Web3 wallet
}
-
-
-
- {buttonLabel} {formattedType}
-
-
- Cancel
-
-
-
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/NavBarLinks.test.tsx b/packages/clerk-js/src/ui/userProfile/NavBarLinks.test.tsx
deleted file mode 100644
index bc7fc2e2cbf..00000000000
--- a/packages/clerk-js/src/ui/userProfile/NavBarLinks.test.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import * as React from 'react';
-
-import { DefaultNavBarLinks } from './NavBarLinks';
-
-jest.mock('ui/router/RouteContext');
-
-describe(' ', () => {
- it('renders the default user profile navigation links', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/NavBarLinks.tsx b/packages/clerk-js/src/ui/userProfile/NavBarLinks.tsx
deleted file mode 100644
index 5a5416421bb..00000000000
--- a/packages/clerk-js/src/ui/userProfile/NavBarLinks.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-// @ts-ignore
-import { default as ShieldIcon } from '@clerk/shared/assets/icons/shield.svg';
-// @ts-ignore
-import { default as UserIcon } from '@clerk/shared/assets/icons/user.svg';
-import React from 'react';
-import { Link, LinkProps } from 'ui/router';
-
-export interface NavbarLinkOptions {
- icon: JSX.Element;
- index: boolean;
- label: string;
- to: string;
-}
-
-export function NavbarLink(props: React.PropsWithChildren>): JSX.Element {
- return (
-
- );
-}
-
-const DEFAULT_NAV_BAR_LINKS = [
- {
- to: 'account',
- icon: ,
- index: true,
- label: 'Account',
- },
- {
- to: 'security',
- icon: ,
- index: false,
- label: 'Security',
- },
-];
-
-export function renderNavBarLinks(navLinks: NavbarLinkOptions[]): JSX.Element {
- return (
- <>
- {navLinks.map(({ to, index, icon, label }, i) => {
- return (
-
- {label}
-
- );
- })}
- >
- );
-}
-
-export function DefaultNavBarLinks(): JSX.Element {
- return renderNavBarLinks(DEFAULT_NAV_BAR_LINKS);
-}
diff --git a/packages/clerk-js/src/ui/userProfile/UserProfile.test.tsx b/packages/clerk-js/src/ui/userProfile/UserProfile.test.tsx
deleted file mode 100644
index 2c57b6dfaae..00000000000
--- a/packages/clerk-js/src/ui/userProfile/UserProfile.test.tsx
+++ /dev/null
@@ -1,225 +0,0 @@
-import { renderJSONAfterFirstAct } from '@clerk/shared/testUtils';
-import {
- Clerk,
- EmailAddressResource,
- ExternalAccountJSON,
- PhoneNumberResource,
- SessionActivity,
- SessionResource,
- SessionWithActivitiesResource,
- SignInResource,
- SignUpResource,
- VerificationJSON,
- Web3WalletResource,
-} from '@clerk/types';
-import { AuthConfig, ExternalAccount, UserSettings } from 'core/resources/internal';
-import React from 'react';
-import ReactDOM from 'react-dom';
-
-import { UserProfile } from './UserProfile';
-
-const mockNavigate = jest.fn();
-const mockUseCoreSignIn = jest.fn(
- () =>
- ({
- status: null,
- } as SignInResource),
-);
-const mockUseCoreSignUp = jest.fn(
- () =>
- ({
- status: null,
- } as SignUpResource),
-);
-
-const mockUseCoreSessionList = jest.fn(() => [] as SessionResource[]);
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/hooks', () => ({
- useNavigate: jest.fn(() => {
- return {
- navigate: mockNavigate,
- };
- }),
-}));
-
-const sessionWithActivities: Partial = {
- id: 'sess_id',
- lastActiveAt: new Date(),
- latestActivity: {
- id: 'session_activity_1/',
- country: 'greece',
- isMobile: false,
- } as any as SessionActivity,
-};
-
-const externalAccount = new ExternalAccount(
- {
- id: 'fbac_yolo',
- provider: 'facebook',
- approved_scopes: 'email',
- email_address: 'peter@gmail.com',
- first_name: 'Peter',
- last_name: 'Smith',
- provider_user_id: '10147951078263327',
- verification: { status: 'verified' } as VerificationJSON,
- } as unknown as ExternalAccountJSON,
- '/path',
-);
-
-jest.mock('ui/contexts', () => ({
- useCoreSignIn: () => mockUseCoreSignIn(),
- useCoreSignUp: () => mockUseCoreSignUp(),
- useCoreSessionList: () => mockUseCoreSessionList(),
- useCoreSession: jest.fn(),
- useEnvironment: jest.fn(() => ({
- displayConfig: {
- theme: {
- general: {
- color: '#000000',
- },
- },
- },
- userSettings: {
- attributes: {
- phone_number: {
- // this should be true since it is a first factor but keeping it false for the needs of the test case
- enabled: false,
- used_for_second_factor: true,
- second_factors: ['phone_code'],
- },
- email_address: {
- // this should be true since it is a first factor but keeping it false for the needs of the test case
- enabled: false,
- used_for_first_factor: true,
- first_factors: ['email_code'],
- },
- first_name: {
- enabled: true,
- },
- last_name: {
- enabled: true,
- },
- username: {
- enabled: false,
- },
- password: {
- enabled: false,
- },
- web3_wallet: {
- enabled: false,
- },
- },
- social: {
- oauth_google: {
- enabled: true,
- required: false,
- authenticatable: true,
- strategy: 'oauth_google',
- },
- oauth_facebook: {
- enabled: true,
- required: false,
- authenticatable: true,
- strategy: 'oauth_facebook',
- },
- },
- } as Partial,
- authConfig: {
- singleSessionMode: true,
- } as Partial,
- })),
- withCoreUserGuard: (a: any) => a,
- useCoreUser: () => {
- return {
- twoFactorEnabled: () => true,
- externalAccounts: [externalAccount],
- verifiedExternalAccounts: [externalAccount],
- unverifiedExternalAccounts: [],
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: '1234',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as PhoneNumberResource,
- {
- id: '2',
- phoneNumber: '5678',
- verification: { status: 'unverified' },
- linkedTo: [],
- } as any as PhoneNumberResource,
- ],
- emailAddresses: [
- {
- id: 1,
- emailAddress: 'clerk@clerk.dev',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as EmailAddressResource,
- {
- id: 2,
- emailAddress: 'clerk-unverified@clerk.dev',
- verification: { status: 'unverified' },
- linkedTo: [],
- } as any as EmailAddressResource,
- ],
- web3Wallets: [
- {
- web3Wallet: '0x0000000000000000000000000000000000000000',
- verification: { status: 'verified' },
- } as Web3WalletResource,
- ],
- getSessions: () => {
- return Promise.resolve([sessionWithActivities]);
- },
- };
- },
- useCoreClerk: () => {
- return {
- navigate: (to: string) => {
- mockNavigate(to);
- if (to) {
- // @ts-ignore
- window.location = new URL(to, window.location.origin);
- }
- return Promise.resolve();
- },
- } as Clerk;
- },
-}));
-
-// import { Link } from 'ui/router';
-
-jest.mock('ui/router', () => {
- return {
- // TODO add real Route/Link
- // eslint-disable-next-line react/display-name
- Route: ({ children }: any) => <>{children}>,
- // eslint-disable-next-line react/display-name
- Link: ({ children }: any) => <>{children}>,
- useRouter: () => {
- return {
- params: { social_account_id: 'fbac_yolo' },
- resolve: () => {
- return {
- toURL: {
- href: 'http://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-// @ts-ignore
-ReactDOM.createPortal = node => node;
-
-describe(' ', () => {
- it('renders the UserProfileContent', async () => {
- const tree = renderJSONAfterFirstAct( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/UserProfile.tsx b/packages/clerk-js/src/ui/userProfile/UserProfile.tsx
deleted file mode 100644
index c013e91dcad..00000000000
--- a/packages/clerk-js/src/ui/userProfile/UserProfile.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import type { UserProfileProps } from '@clerk/types';
-import React from 'react';
-import { PoweredByClerk } from 'ui/common';
-import { withCoreUserGuard } from 'ui/contexts';
-
-import { AccountRoutes } from './account';
-import { DefaultNavBarLinks } from './NavBarLinks';
-import { SecurityRoutes } from './security';
-import { VerifyMagicLinkRoutes } from './VerifyMagicLink';
-
-const UserProfile = withCoreUserGuard(({ hideNavigation, only }) => {
- let components;
-
- if (only) {
- hideNavigation = true;
- }
-
- switch (only) {
- case 'account':
- components = ;
- break;
- case 'security':
- components = ;
- break;
- default:
- components = (
- <>
-
-
-
- >
- );
- break;
- }
-
- return (
- <>
- {!hideNavigation && (
-
-
-
- )}
-
- {components}
-
-
- >
- );
-});
-
-export { UserProfile };
diff --git a/packages/clerk-js/src/ui/userProfile/VerifyMagicLink.tsx b/packages/clerk-js/src/ui/userProfile/VerifyMagicLink.tsx
deleted file mode 100644
index b1270d34c4b..00000000000
--- a/packages/clerk-js/src/ui/userProfile/VerifyMagicLink.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import { VerifyMagicLink } from 'ui/common';
-import { Route } from 'ui/router';
-
-export const VerifyMagicLinkRoutes = (): JSX.Element => {
- return (
-
-
-
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/__snapshots__/NavBarLinks.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/__snapshots__/NavBarLinks.test.tsx.snap
deleted file mode 100644
index 5e76316ba5c..00000000000
--- a/packages/clerk-js/src/ui/userProfile/__snapshots__/NavBarLinks.test.tsx.snap
+++ /dev/null
@@ -1,24 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the default user profile navigation links 1`] = `
-Array [
-
-
- Account
- ,
-
-
- Security
- ,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/__snapshots__/UserProfile.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/__snapshots__/UserProfile.test.tsx.snap
deleted file mode 100644
index 2194ccb3bd6..00000000000
--- a/packages/clerk-js/src/ui/userProfile/__snapshots__/UserProfile.test.tsx.snap
+++ /dev/null
@@ -1,6943 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the UserProfileContent 1`] = `
-Array [
-
- Account
- Security
- ,
-
-
-
-
- Account
-
-
- Manage settings related to your account
-
-
-
-
-
-
- Profile
-
-
- Manage profile settings
-
-
-
-
-
- Photo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Social accounts
-
-
-
-
-
-
- peter@gmail.com
-
-
-
-
-
-
-
-
-
-
-
-
-
- Personal information
-
-
- Manage personal information settings
-
-
-
-
-
- First name
-
-
-
-
-
- Last name
-
-
-
-
-
-
-
-
-
- First name
-
-
- Edit your first name
-
-
-
-
-
-
-
-
- Last name
-
-
- Edit your last name
-
-
-
-
-
-
-
-
- Username
-
-
- Edit your username
-
-
-
-
-
-
-
-
- Emails
-
-
- Manage addresses associated with your account
-
-
-
-
-
-
-
-
-
- clerk@clerk.dev
-
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
- clerk-unverified@clerk.dev
-
-
-
- Unverified
-
-
-
-
-
-
-
-
-
-
-
- Add email address
-
-
-
-
-
-
- Add email
-
-
- Enter an email address to add
-
-
-
-
-
-
-
-
- Phone numbers
-
-
- Manage phone numbers associated with your account
-
-
-
-
-
-
-
-
-
-
- +
- 1
-
- (123) 4
-
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- +
- 56
-
- 5678
-
-
-
- Unverified
-
-
-
-
-
-
-
-
-
-
-
- Add phone number
-
-
-
-
-
-
- Add phone
-
-
- Enter a phone number to add
-
-
-
-
-
-
-
-
- Web3 wallets
-
-
- Manage web3 wallets associated with your account
-
-
-
-
-
-
-
-
-
- 0x0000000000000000000000000000000000000000
-
-
-
- Primary
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Web3 wallet
-
-
- Manage this Web3 wallet
-
-
-
-
-
-
-
-
-
-
- 0x0000000000000000000000000000000000000000
-
-
- Primary
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Primary web3 wallet
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Unlink
-
-
-
-
-
-
- Add web3 wallet
-
-
- Connect your web3 wallet
-
-
-
-
-
-
-
-
- Connect
- MetaMask
- wallet
-
-
-
-
-
-
-
-
-
-
-
- Social accounts
-
-
-
-
-
-
-
-
-
-
-
- peter@gmail.com
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Connect
- Google
- account
-
-
-
-
-
-
-
-
-
-
-
-
-
- Â
- Facebook Account
-
-
-
-
-
-
-
-
-
- Photo
-
-
-
-
-
-
-
-
-
-
-
-
- Unlink
-
-
-
-
-
- Security
-
-
- Manage settings related to account security
-
-
-
-
-
-
- Sign in
-
-
- Manage authentication settings
-
-
-
-
-
- 2-step verification
-
-
-
-
- Currently
-
- ON
-
-
-
- An additional authentication step is required when signing in
-
-
-
-
-
-
-
-
-
-
-
-
-
- Active devices
-
-
- Manage devices currently signed in to your account
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2-step verification
-
-
- Use a verification code when signing in from an unfamiliar device
-
-
-
-
-
-
- Add method
-
-
- Set up a new 2-step verification method
-
-
-
-
-
- SMS code
-
-
-
-
-
- Receive a verification code via SMS when signing in
-
-
- Add SMS code verification
-
-
-
-
-
-
-
-
-
-
-
-
- Add two-step verification
-
-
- Choose a phone number to receive a verification code
-
-
-
-
-
-
-
-
- +
- 1
-
- (123) 4
-
-
-
- }
- className="checkmark"
- tabIndex={0}
- />
-
-
-
-
- Add new number
-
-
- A text message with a verification code will be sent to your phone number.
-
- Standard carrier SMS and data fees may apply.
-
-
-
-
- Continue
-
-
- Cancel
-
-
-
-
-
-
-
- Add phone
-
-
- Enter a phone number to add
-
-
-
-
-
-
-
-
- Password
-
-
- Change your password
-
-
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/__snapshots__/util.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/__snapshots__/util.test.tsx.snap
deleted file mode 100644
index b8474f5c45c..00000000000
--- a/packages/clerk-js/src/ui/userProfile/__snapshots__/util.test.tsx.snap
+++ /dev/null
@@ -1,26 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Utility components for EmailAddresses renders email connections 1`] = `
-Array [
-
- Connected to
- Google
-
,
-
- Connected to
- Facebook
-
,
-]
-`;
-
-exports[`Utility components for EmailAddresses renders the primary tag 1`] = `
-
- Primary
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/account/Account.test.tsx b/packages/clerk-js/src/ui/userProfile/account/Account.test.tsx
deleted file mode 100644
index 38e180c2615..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/Account.test.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-import { render, screen } from '@clerk/shared/testUtils';
-import type { UserResource, UserSettingsResource } from '@clerk/types';
-import React from 'react';
-
-import { Account } from './Account';
-
-const mockEnvironment = jest.fn();
-
-jest.mock('ui/contexts', () => {
- return {
- // @ts-ignore 2698
- // ...jest.requireActual('ui/contexts'),
- useEnvironment: () => ({
- ...mockEnvironment(),
- displayConfig: {},
- }),
- // @ts-ignore 2352
- useCoreUser: () => ({ externalAccounts: [], verifiedExternalAccounts: [], unverifiedExternalAccounts: [] } as UserResource),
- useCoreClerk: jest.fn(),
- };
-});
-
-jest.mock('ui/hooks', () => {
- return {
- useNavigate: () => ({ navigate: jest.fn() }),
- };
-});
-
-const OTHER_ATTRIBUTES = {
- username: {
- enabled: false,
- },
- email_address: {
- enabled: false,
- },
- phone_number: {
- enabled: false,
- },
- web3_wallet: {
- enabled: false,
- },
-};
-
-describe(' ', () => {
- afterEach(() => {
- jest.clearAllMocks();
- });
-
- it('renders personal information for auth config that requires name', () => {
- mockEnvironment.mockImplementation(() => {
- return {
- userSettings: {
- attributes: {
- first_name: {
- enabled: true,
- required: true,
- },
- last_name: {
- enabled: false,
- },
- ...OTHER_ATTRIBUTES,
- },
- } as UserSettingsResource,
- };
- });
- render( );
- expect(screen.getByText('Personal information')).toBeInTheDocument();
- });
-
- it('renders personal information for auth config that has name turned on', () => {
- mockEnvironment.mockImplementation(() => {
- return {
- userSettings: {
- attributes: {
- last_name: {
- enabled: true,
- },
- first_name: {
- enabled: false,
- },
- ...OTHER_ATTRIBUTES,
- },
- } as UserSettingsResource,
- };
- });
- render( );
- expect(screen.getByText('Personal information')).toBeInTheDocument();
- });
-
- it('does not render personal information for auth config that has named turned off', () => {
- mockEnvironment.mockImplementation(() => {
- return {
- userSettings: {
- attributes: {
- first_name: {
- enabled: false,
- },
- last_name: {
- enabled: false,
- },
- ...OTHER_ATTRIBUTES,
- },
- } as UserSettingsResource,
- };
- });
- render( );
- expect(screen.queryByText('Personal information')).not.toBeInTheDocument();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/account/Account.tsx b/packages/clerk-js/src/ui/userProfile/account/Account.tsx
deleted file mode 100644
index fc43af04984..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/Account.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import React from 'react';
-import { PersonalInformationCard } from 'ui/userProfile/account/personalInformation';
-import { ProfileCard } from 'ui/userProfile/account/profileCard';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-export const Account = (): JSX.Element => {
- return (
- <>
-
-
-
- >
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/AvatarWithUploader.module.scss b/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/AvatarWithUploader.module.scss
deleted file mode 100644
index c35072c9fcf..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/AvatarWithUploader.module.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-.wrapper {
- border-radius: 50%;
- overflow: hidden;
-}
diff --git a/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/AvatarWithUploader.tsx b/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/AvatarWithUploader.tsx
deleted file mode 100644
index 564f9759705..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/AvatarWithUploader.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Avatar, AvatarProps } from '@clerk/shared/components/avatar';
-import { ImageUploader } from '@clerk/shared/components/imageUploader';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-
-//@ts-ignore
-import styles from './AvatarWithUploader.module.scss';
-
-type Empty = unknown;
-
-export const AvatarWithUploader = (props: AvatarProps): JSX.Element => {
- const user = useCoreUser();
- const saveImage = (file: File): Promise => {
- return user.setProfileImage({ file }).catch(error => {
- alert(error);
- });
- };
-
- return (
-
-
-
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/index.ts b/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/index.ts
deleted file mode 100644
index 2acad0c841f..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/avatarWithUploader/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './AvatarWithUploader';
diff --git a/packages/clerk-js/src/ui/userProfile/account/index.tsx b/packages/clerk-js/src/ui/userProfile/account/index.tsx
deleted file mode 100644
index cffe367ac57..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/index.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import React from 'react';
-import { Route } from 'ui/router';
-import { EmailAddressesRoutes } from 'ui/userProfile/emailAdressess';
-import { NameRoutes } from 'ui/userProfile/name';
-import { PhoneNumbersRoutes } from 'ui/userProfile/phoneNumbers';
-import { SocialAccountsRoutes } from 'ui/userProfile/socialAccounts';
-import { UsernameRoutes } from 'ui/userProfile/username';
-import { Web3WalletsRoutes } from 'ui/userProfile/web3Wallets';
-
-import { Account } from './Account';
-
-export { Account };
-
-type AccountRoutesProps = {
- standAlone?: boolean;
- index?: boolean;
-};
-
-export function AccountRoutes({ standAlone = false, index = false }: AccountRoutesProps): JSX.Element {
- return (
-
-
-
-
-
-
-
-
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/account/personalInformation/PersonalInformationCard.tsx b/packages/clerk-js/src/ui/userProfile/account/personalInformation/PersonalInformationCard.tsx
deleted file mode 100644
index e3e46dcc4c6..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/personalInformation/PersonalInformationCard.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import React from 'react';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-
-export const PersonalInformationCard = (): JSX.Element | null => {
- const user = useCoreUser();
- const { navigate } = useNavigate();
- const { userSettings } = useEnvironment();
- const {
- attributes: { first_name, last_name },
- } = userSettings;
-
- const hasAtLeastOneAttributeEnable = first_name?.enabled || last_name?.enabled;
-
- if (!hasAtLeastOneAttributeEnable) {
- return null;
- }
-
- const firstNameRow = (
- navigate('first-name')}
- >
- {user.firstName || ''}
-
- );
-
- const lastnameRow = (
- navigate('last-name')}
- >
- {user.lastName || ''}
-
- );
-
- const showFirstName = first_name.enabled;
- const showLastName = last_name.enabled;
-
- return (
-
-
- {showFirstName && firstNameRow}
- {showLastName && lastnameRow}
-
-
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/account/personalInformation/index.ts b/packages/clerk-js/src/ui/userProfile/account/personalInformation/index.ts
deleted file mode 100644
index bdc46874352..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/personalInformation/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './PersonalInformationCard';
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileCard.test.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileCard.test.tsx
deleted file mode 100644
index c9d6cbaf778..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileCard.test.tsx
+++ /dev/null
@@ -1,211 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { EmailAddressResource, ExternalAccountResource, UserResource, Web3WalletResource } from '@clerk/types';
-import * as React from 'react';
-import { PartialDeep } from 'type-fest';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-
-import { ProfileCard } from './ProfileCard';
-
-jest.mock('ui/hooks', () => {
- return {
- useNavigate: () => ({ navigate: jest.fn() }),
- };
-});
-
-jest.mock('ui/contexts', () => {
- return {
- useEnvironment: jest.fn(),
- useCoreUser: jest.fn(),
- useCoreClerk: jest.fn(),
- };
-});
-
-const userWithoutExtAccounts = (): PartialDeep => {
- return {
- isPrimaryIdentification: jest.fn(() => true),
- emailAddresses: [
- {
- id: 1,
- emailAddress: 'clerk@clerk.dev',
- verification: { status: 'verified' },
- } as any as EmailAddressResource,
- {
- id: 2,
- emailAddress: 'clerk-unverified@clerk.dev',
- verification: { status: 'unverified' },
- } as any as EmailAddressResource,
- ],
- phoneNumbers: [],
- externalAccounts: [],
- verifiedExternalAccounts: [],
- unverifiedExternalAccounts: [],
- web3Wallets: [
- {
- web3Wallet: '0x0000000000000000000000000000000000000000',
- verification: { status: 'verified' },
- } as Web3WalletResource,
- ],
- };
-};
-
-const userWithExtAccounts = (): PartialDeep => {
- return {
- isPrimaryIdentification: jest.fn(() => true),
- emailAddresses: [
- {
- id: 1,
- emailAddress: 'clerk@clerk.dev',
- verification: { status: 'verified' },
- } as any as EmailAddressResource,
- {
- id: 2,
- emailAddress: 'clerk-unverified@clerk.dev',
- verification: { status: 'unverified' },
- } as any as EmailAddressResource,
- ],
- phoneNumbers: [],
- externalAccounts: [
- {
- id: 'eac_google',
- provider: 'google',
- emailAddress: 'sanjay@gmail.com',
- providerTitle: () => 'Google',
- } as ExternalAccountResource,
- {
- id: 'eac_twitch',
- provider: 'twitch',
- emailAddress: 'sanjay@gmail.com',
- username: 'dhalsim',
- providerTitle: () => 'Twitch',
- } as ExternalAccountResource,
- {
- id: 'eac_facebook',
- provider: 'facebook',
- } as ExternalAccountResource,
- ],
- verifiedExternalAccounts: [
- {
- id: 'eac_google',
- provider: 'google',
- emailAddress: 'sanjay@gmail.com',
- providerTitle: () => 'Google',
- } as ExternalAccountResource,
- {
- id: 'eac_twitch',
- provider: 'twitch',
- emailAddress: 'sanjay@gmail.com',
- username: 'dhalsim',
- providerTitle: () => 'Twitch',
- } as ExternalAccountResource,
- ],
- unverifiedExternalAccounts: [
- {
- id: 'eac_facebook',
- provider: 'facebook',
- providerTitle: () => 'Facebook',
- } as ExternalAccountResource,
- ],
- web3Wallets: [{ web3Wallet: '0x123456789' }],
- };
-};
-
-const envWithEmailPhone = () => ({
- displayConfig: {},
- userSettings: {
- attributes: {
- email_address: {
- enabled: true,
- },
- phone_number: {
- enabled: true,
- },
- username: {
- enabled: false,
- },
- web3_wallet: {
- enabled: false,
- },
- },
- },
-});
-
-const envWithExternalAccount = () => ({
- displayConfig: {},
- userSettings: {
- attributes: {
- email_address: {
- enabled: true,
- },
- phone_number: {
- enabled: true,
- },
- username: {
- enabled: false,
- },
- web3_wallet: {
- enabled: false,
- },
- },
- social: {
- oauth_google: {
- enabled: true,
- },
- oauth_twitch: {
- enabled: true,
- },
- oauth_facebook: {
- enabled: true,
- },
- },
- },
-});
-
-const envWithWeb3Wallet = () => ({
- displayConfig: {},
- userSettings: {
- attributes: {
- email_address: {
- enabled: true,
- },
- phone_number: {
- enabled: true,
- },
- username: {
- enabled: false,
- },
- web3_wallet: {
- enabled: true,
- },
- },
- },
-});
-
-describe(' ', () => {
- afterEach(() => {
- jest.clearAllMocks();
- });
-
- it('renders the ProfileCard', () => {
- (useEnvironment as jest.Mock).mockImplementation(envWithEmailPhone);
- (useCoreUser as jest.Mock).mockImplementation(userWithoutExtAccounts);
-
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders the ProfileCard with web3 wallet', () => {
- (useEnvironment as jest.Mock).mockImplementation(envWithWeb3Wallet);
- (useCoreUser as jest.Mock).mockImplementation(userWithoutExtAccounts);
-
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders the profile card with verified external accounts', () => {
- (useEnvironment as jest.Mock).mockImplementation(envWithExternalAccount);
- (useCoreUser as jest.Mock).mockImplementation(userWithExtAccounts);
-
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileCard.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileCard.tsx
deleted file mode 100644
index f1b6b9da6f3..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileCard.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import React from 'react';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-
-import { AvatarWithUploader } from '../avatarWithUploader';
-import { ProfileEmailAddresses } from './ProfileEmailAddresses';
-import { ProfilePhoneNumbers } from './ProfilePhoneNumbers';
-import { ProfileSocialAccounts } from './ProfileSocialAccounts';
-import { ProfileWeb3Wallets } from './ProfileWeb3Wallets';
-
-export function ProfileCard(): JSX.Element {
- const { userSettings } = useEnvironment();
- const { attributes, social } = userSettings;
- const user = useCoreUser();
- const { navigate } = useNavigate();
-
- const buildUsernameRow = () => (
- navigate('username')}
- >
- {user.username}
-
- );
-
- const avatarRow = (
-
-
-
- );
-
- const showUsername = attributes.username.enabled;
- const showEmail = attributes.email_address.enabled;
- const showPhone = attributes.phone_number.enabled;
- const showSocialAccount = social && Object.values(social).filter(p => p.enabled).length > 0;
- const showWebWallet = attributes.web3_wallet.enabled;
-
- return (
-
-
- {avatarRow}
- {showUsername && buildUsernameRow()}
- {showEmail && }
- {showPhone && }
- {showSocialAccount && }
- {showWebWallet && }
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileEmailAddresses.test.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileEmailAddresses.test.tsx
deleted file mode 100644
index d253c18e597..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileEmailAddresses.test.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { EmailAddressResource, UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { ProfileEmailAddresses } from './ProfileEmailAddresses';
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: jest.fn(() => {
- return {
- navigate: mockNavigate,
- };
- }),
-}));
-
-const mockIdentIsPrimary = jest.fn();
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- isPrimaryIdentification: mockIdentIsPrimary,
- emailAddresses: [
- {
- id: 1,
- emailAddress: 'clerk@clerk.dev',
- verification: { status: 'verified' },
- } as any as EmailAddressResource,
- {
- id: 2,
- emailAddress: 'clerk-unverified@clerk.dev',
- verification: { status: 'unverified' },
- } as any as EmailAddressResource,
- ],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the ProfileEmailAddresses', () => {
- mockIdentIsPrimary.mockImplementationOnce(() => true);
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileEmailAddresses.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileEmailAddresses.tsx
deleted file mode 100644
index 5cde5dcce65..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileEmailAddresses.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { Tag, VerificationStatusTag } from '@clerk/shared/components/tag';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-
-export function ProfileEmailAddresses(): JSX.Element {
- const { navigate } = useNavigate();
- const user = useCoreUser();
-
- return (
- navigate('email-addresses')}
- >
- {user.emailAddresses.length === 0 ? (
- None
- ) : (
-
- {user.emailAddresses.map(emailIdent => (
-
- {emailIdent.emailAddress}
- {user.isPrimaryIdentification(emailIdent) && Primary }
-
-
- ))}
-
- )}
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfilePhoneNumbers.test.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfilePhoneNumbers.test.tsx
deleted file mode 100644
index e8a39f60c21..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfilePhoneNumbers.test.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { PhoneNumberResource, UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { ProfilePhoneNumbers } from './ProfilePhoneNumbers';
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: jest.fn(() => {
- return {
- navigate: mockNavigate,
- };
- }),
-}));
-
-const mockIdentIsPrimary = jest.fn();
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- isPrimaryIdentification: mockIdentIsPrimary,
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: '1234',
- verification: { status: 'verified' },
- } as any as PhoneNumberResource,
- {
- id: '2',
- phoneNumber: '5678',
- verification: { status: 'unverified' },
- } as any as PhoneNumberResource,
- ],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the ProfilePhoneNumbers', () => {
- mockIdentIsPrimary.mockImplementationOnce(() => true);
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfilePhoneNumbers.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfilePhoneNumbers.tsx
deleted file mode 100644
index 7f27e4b88d2..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfilePhoneNumbers.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { PhoneViewer } from '@clerk/shared/components/phoneInput';
-import { Tag, VerificationStatusTag } from '@clerk/shared/components/tag';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-
-export function ProfilePhoneNumbers(): JSX.Element {
- const { navigate } = useNavigate();
- const user = useCoreUser();
-
- return (
- navigate('phone-numbers')}
- >
- {user.phoneNumbers.length === 0 ? (
- None
- ) : (
-
- {user.phoneNumbers.map(phoneIdent => (
-
-
- {user.isPrimaryIdentification(phoneIdent) &&
Primary }
-
-
- ))}
-
- )}
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileSocialAccounts.test.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileSocialAccounts.test.tsx
deleted file mode 100644
index 1b7bde69581..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileSocialAccounts.test.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { ExternalAccountResource, UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { ProfileSocialAccounts } from './ProfileSocialAccounts';
-
-const mockVerifiedExternalAccount = {
- id: '1',
- provider: 'google',
- emailAddress: 'clerk@clerk.dev',
- verification: { status: 'verified' },
- providerTitle: () => 'Google',
-} as ExternalAccountResource;
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: jest.fn(() => {
- return {
- navigate: mockNavigate,
- };
- }),
-}));
-
-const mockIdentIsPrimary = jest.fn();
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- externalAccounts: [mockVerifiedExternalAccount],
- verifiedExternalAccounts: [mockVerifiedExternalAccount],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the ProfileSocialAccounts', () => {
- mockIdentIsPrimary.mockImplementationOnce(() => true);
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileSocialAccounts.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileSocialAccounts.tsx
deleted file mode 100644
index cf390d38351..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileSocialAccounts.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { ExternalAccountResource } from '@clerk/types';
-import React from 'react';
-import { svgUrl } from 'ui/common';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-
-export function ProfileSocialAccounts(): JSX.Element {
- const { navigate } = useNavigate();
- const user = useCoreUser();
- const verifiedAccounts = user.verifiedExternalAccounts;
-
- return (
- navigate('social-accounts')}
- >
- {verifiedAccounts.length === 0 ? (
- None
- ) : (
-
- {verifiedAccounts.map((externalAccount: ExternalAccountResource) => (
-
-
-
- {externalAccount.username || externalAccount.emailAddress}
-
- ))}
-
- )}
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileWeb3Wallets.tsx b/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileWeb3Wallets.tsx
deleted file mode 100644
index 5ae5a09dd31..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/ProfileWeb3Wallets.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { Tag, VerificationStatusTag } from '@clerk/shared/components/tag';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-
-export function ProfileWeb3Wallets(): JSX.Element {
- const { navigate } = useNavigate();
- const user = useCoreUser();
-
- return (
- navigate('web3-wallets')}
- >
- {user.web3Wallets.length > 0 ? (
-
- {user.web3Wallets.map(web3Wallet => (
-
- {web3Wallet.web3Wallet}
- {user.isPrimaryIdentification(web3Wallet) && Primary }
- {web3Wallet.verification.status && (
-
- )}
-
- ))}
-
- ) : (
- None
- )}
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileCard.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileCard.test.tsx.snap
deleted file mode 100644
index 7baf8ac6938..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileCard.test.tsx.snap
+++ /dev/null
@@ -1,573 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the ProfileCard 1`] = `
-
-
-
- Profile
-
-
- Manage profile settings
-
-
-
-
-
- Photo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Email
-
-
-
-
-
- clerk@clerk.dev
-
- Primary
-
-
- Verified
-
-
-
- clerk-unverified@clerk.dev
-
- Primary
-
-
- Unverified
-
-
-
-
-
-
-
-
-
-
-
- Phone number
-
-
-
-
-
-`;
-
-exports[` renders the ProfileCard with web3 wallet 1`] = `
-
-
-
- Profile
-
-
- Manage profile settings
-
-
-
-
-
- Photo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Email
-
-
-
-
-
- clerk@clerk.dev
-
- Primary
-
-
- Verified
-
-
-
- clerk-unverified@clerk.dev
-
- Primary
-
-
- Unverified
-
-
-
-
-
-
-
-
-
-
-
- Phone number
-
-
-
-
-
- Web3 wallet
-
-
-
-
-
- 0x0000000000000000000000000000000000000000
-
- Primary
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` renders the profile card with verified external accounts 1`] = `
-
-
-
- Profile
-
-
- Manage profile settings
-
-
-
-
-
- Photo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Email
-
-
-
-
-
- clerk@clerk.dev
-
- Primary
-
-
- Verified
-
-
-
- clerk-unverified@clerk.dev
-
- Primary
-
-
- Unverified
-
-
-
-
-
-
-
-
-
-
-
- Phone number
-
-
-
-
-
- Social accounts
-
-
-
-
-
-
- sanjay@gmail.com
-
-
-
- dhalsim
-
-
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileEmailAddresses.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileEmailAddresses.test.tsx.snap
deleted file mode 100644
index f7a18de3d62..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileEmailAddresses.test.tsx.snap
+++ /dev/null
@@ -1,55 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the ProfileEmailAddresses 1`] = `
-
-
- Email
-
-
-
-
-
- clerk@clerk.dev
-
- Primary
-
-
- Verified
-
-
-
- clerk-unverified@clerk.dev
-
- Unverified
-
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfilePhoneNumbers.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfilePhoneNumbers.test.tsx.snap
deleted file mode 100644
index efa98cdae0b..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfilePhoneNumbers.test.tsx.snap
+++ /dev/null
@@ -1,69 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the ProfilePhoneNumbers 1`] = `
-
-
- Phone number
-
-
-
-
-
-
- +
- 1
-
- (123) 4
-
-
- Primary
-
-
- Verified
-
-
-
-
- +
- 56
-
- 5678
-
-
- Unverified
-
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileSocialAccounts.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileSocialAccounts.test.tsx.snap
deleted file mode 100644
index e4a707f7b55..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/__snapshots__/ProfileSocialAccounts.test.tsx.snap
+++ /dev/null
@@ -1,42 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the ProfileSocialAccounts 1`] = `
-
-
- Social accounts
-
-
-
-
-
-
- clerk@clerk.dev
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/account/profileCard/index.ts b/packages/clerk-js/src/ui/userProfile/account/profileCard/index.ts
deleted file mode 100644
index d6fa6ff6cda..00000000000
--- a/packages/clerk-js/src/ui/userProfile/account/profileCard/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './ProfileCard';
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/AddNewEmail.test.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/AddNewEmail.test.tsx
deleted file mode 100644
index 32dff297a22..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/AddNewEmail.test.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { EmailAddressResource, EnvironmentResource, UserResource } from '@clerk/types';
-import React from 'react';
-import { PartialDeep } from 'type-fest';
-import { AddNewEmail } from './AddNewEmail';
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- params: { email_address_id: '1' },
- resolve: () => {
- return {
- toURL: {
- href: 'http://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- primaryEmailAddressId: '1',
- emailAddresses: [
- {
- id: '1',
- email_address: 'clerk1@clerk.dev',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as EmailAddressResource,
- ],
- };
- },
- };
-});
-
-jest.mock('ui/contexts/EnvironmentContext', () => {
- return {
- useEnvironment: jest.fn(
- () =>
- ({
- userSettings: {
- attributes: {
- email_address: {
- enabled: true,
- verifications: ['email_link'],
- },
- },
- },
- } as PartialDeep),
- ),
- };
-});
-
-describe(' ', () => {
- it('renders the AddNewEmail', async () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/AddNewEmail.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/AddNewEmail.tsx
deleted file mode 100644
index 2a98d4f729f..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/AddNewEmail.tsx
+++ /dev/null
@@ -1,153 +0,0 @@
-// @ts-ignore
-import { default as MailIcon } from '@clerk/shared/assets/icons/mail.svg';
-import { Button } from '@clerk/shared/components/button';
-import { Control } from '@clerk/shared/components/control';
-import { Form } from '@clerk/shared/components/form';
-import { InputWithIcon } from '@clerk/shared/components/input';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { EmailAddressResource } from '@clerk/types';
-import React from 'react';
-import { handleError, useFieldState } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { EmailAddressVerificationWithMagicLink } from 'ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink';
-import { EmailAddressVerificationWithOTP } from 'ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP';
-import { magicLinksEnabledForInstance } from 'ui/userProfile/emailAdressess/utils';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-enum Step {
- EnterEmailAddress = 0,
- VerifyEmailAddress = 1,
- Finish = 2,
-}
-
-const stepSubtitleMap = {
- [Step.EnterEmailAddress]: 'Enter an email address to add',
- [Step.VerifyEmailAddress]: 'Verify the email address',
- [Step.Finish]: 'Email address successfully added',
-};
-
-export function AddNewEmail(): JSX.Element {
- const user = useCoreUser();
- const { navigate } = useNavigate();
- const environment = useEnvironment();
- const [step, setStep] = React.useState(Step.EnterEmailAddress);
- const [error, setError] = React.useState();
- const createdEmailRef = React.useRef();
- const emailValue = useFieldState('email_address', '');
-
- const magicLinksEnabled = magicLinksEnabledForInstance(environment);
- const nextStep = () => setStep(s => s + 1);
- const navigateBack = () => navigate('../');
- const navigateToCreatedEmailAddress = () => {
- if (createdEmailRef.current) {
- navigate(`../${createdEmailRef.current.id}`);
- }
- };
-
- const createEmailAddress = async (e: React.FormEvent) => {
- e.preventDefault();
- return user
- .createEmailAddress({ email: emailValue.value })
- .then(res => {
- createdEmailRef.current = res;
- nextStep();
- })
- .catch(e => handleError(e, [emailValue], setError));
- };
-
- const onErrorHandler = (e: any) => {
- handleError(e, [emailValue], setError);
- };
-
- const onVerificationCompleteHandler = () => {
- nextStep();
- };
-
- const enterEmailForm = step === Step.EnterEmailAddress && (
-
- );
-
- const verifyEmailScreen =
- step === Step.VerifyEmailAddress &&
- createdEmailRef.current &&
- (magicLinksEnabled ? (
-
- ) : (
-
- ));
-
- const finishScreen = step === Step.Finish && (
- <>
-
- {emailValue.value} has successfully been added to your account.
-
-
- Finish
-
- >
- );
-
- const title = magicLinksEnabled && step === Step.VerifyEmailAddress ? undefined : 'Add email';
-
- const subtitle = magicLinksEnabled && step === Step.VerifyEmailAddress ? undefined : stepSubtitleMap[step];
-
- return (
- <>
-
-
- {error}
-
- {enterEmailForm}
- {verifyEmailScreen}
- {finishScreen}
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink.test.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink.test.tsx
deleted file mode 100644
index 03a0e5f5a37..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink.test.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { render, renderJSON } from '@clerk/shared/testUtils';
-import { EmailAddressResource } from '@clerk/types';
-import { waitFor } from '@testing-library/dom';
-import React from 'react';
-
-import { EmailAddressVerificationWithMagicLink } from './EmailAddressVerificationWithMagicLink';
-
-jest.mock('ui/contexts', () => {
- return {
- useUserProfileContext: jest.fn(() => {
- return {
- routing: 'path',
- path: '/user',
- };
- }),
- };
-});
-
-describe(' ', function () {
- it('renders the component', function () {
- const email = {
- id: '1',
- emailAddress: 'boss@clerk.dev',
- createMagicLinkFlow: jest.fn(() => ({
- startMagicLinkFlow: () =>
- Promise.resolve({
- status: 'verified',
- }),
- cancelMagicLinkFlow: () => {
- return;
- },
- })),
- } as any as EmailAddressResource;
-
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('calls onVerificationComplete when the email address gets verified', async function () {
- const mockStartMagicLinkFlow = jest.fn(() =>
- Promise.resolve({
- status: 'verified',
- }),
- );
- const mockOnVerificationCompleteHandler = jest.fn();
- const email = {
- id: '1',
- emailAddress: 'boss@clerk.dev',
- createMagicLinkFlow: () => ({
- startMagicLinkFlow: mockStartMagicLinkFlow,
- cancelMagicLinkFlow: () => {
- return;
- },
- }),
- } as any as EmailAddressResource;
-
- render(
- ,
- );
-
- await waitFor(() => {
- expect(mockOnVerificationCompleteHandler).toHaveBeenCalled();
- });
- });
-
- it('calls onError when the verification fails with an error', async function () {
- const mockStartMagicLinkFlow = jest.fn(() => Promise.reject('error'));
- const mockOnErrorHandler = jest.fn();
- const email = {
- id: '1',
- emailAddress: 'boss@clerk.dev',
- createMagicLinkFlow: () => ({
- startMagicLinkFlow: mockStartMagicLinkFlow,
- cancelMagicLinkFlow: () => {
- return;
- },
- }),
- } as any as EmailAddressResource;
-
- render(
- ,
- );
-
- await waitFor(() => {
- expect(mockOnErrorHandler).toHaveBeenCalledWith('error');
- });
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink.tsx
deleted file mode 100644
index cdec847b6a2..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { noop } from '@clerk/shared/utils/noop';
-import { EmailAddressResource } from '@clerk/types';
-import React from 'react';
-import { buildMagicLinkRedirectUrl, MagicLinkWaitingScreen } from 'ui/common';
-import { useUserProfileContext } from 'ui/contexts';
-import { useMagicLink } from 'ui/hooks';
-
-type EmailAddressVerificationWithMagicLinkProps = {
- email: EmailAddressResource;
- onVerificationComplete?: () => void;
- onError?: (err: any) => void;
- className?: string;
-};
-
-export function EmailAddressVerificationWithMagicLink({
- email,
- onError = noop,
- onVerificationComplete = noop,
- className,
-}: EmailAddressVerificationWithMagicLinkProps): JSX.Element {
- const profileContext = useUserProfileContext();
-
- const { startMagicLinkFlow } = useMagicLink(email);
-
- React.useEffect(() => {
- startVerification();
- }, []);
-
- function startVerification() {
- const redirectUrl = buildMagicLinkRedirectUrl(profileContext);
- startMagicLinkFlow({ redirectUrl }).then(onVerificationComplete).catch(onError);
- }
-
- return (
-
- A verification link has been sent to
-
- {email.emailAddress}
- >
- }
- secondaryText='Click the link in the email to verify your new email, then return to
- this tab.'
- className={className}
- onResendButtonClicked={startVerification}
- />
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP.test.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP.test.tsx
deleted file mode 100644
index 749b2026f2d..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP.test.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { render, renderJSON, screen, userEvent } from '@clerk/shared/testUtils';
-import { EmailAddressResource } from '@clerk/types';
-import { waitFor } from '@testing-library/dom';
-import React from 'react';
-
-import { EmailAddressVerificationWithOTP } from './EmailAddressVerificationWithOTP';
-
-jest.mock('ui/contexts', () => {
- return {
- useEnvironment: jest.fn(() => ({
- authConfig: {
- firstFactors: ['email_link'],
- },
- })),
- useUserProfileContext: jest.fn(() => {
- return {
- routing: 'path',
- path: '/user',
- };
- }),
- };
-});
-
-describe(' ', function () {
- it('renders the component', function () {
- const email = {
- id: '1',
- emailAddress: 'boss@clerk.dev',
- prepareVerification: jest.fn(() => Promise.resolve()),
- attemptVerification: jest.fn(() => Promise.resolve()),
- } as any as EmailAddressResource;
-
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('calls onVerificationComplete when the email address gets verified', async function () {
- const mockOnVerificationCompleteHandler = jest.fn();
- const email = {
- id: '1',
- emailAddress: 'boss@clerk.dev',
- prepareVerification: jest.fn(() => Promise.resolve()),
- attemptVerification: jest.fn(() => Promise.resolve()),
- } as any as EmailAddressResource;
-
- render(
- ,
- );
-
- userEvent.type(screen.getByLabelText('Enter verification code. Digit 1'), '1');
- userEvent.type(screen.getByLabelText('Digit 2'), '2');
- userEvent.type(screen.getByLabelText('Digit 3'), '3');
- userEvent.type(screen.getByLabelText('Digit 4'), '4');
- userEvent.type(screen.getByLabelText('Digit 5'), '5');
- userEvent.type(screen.getByLabelText('Digit 6'), '6');
-
- await waitFor(() => {
- expect(mockOnVerificationCompleteHandler).toHaveBeenCalled();
- });
- });
-
- it('calls onError when the verification fails with an error', async function () {
- const mockOnErrorHandler = jest.fn();
- const email = {
- id: '1',
- emailAddress: 'boss@clerk.dev',
- prepareVerification: jest.fn(() => Promise.reject('error')),
- attemptVerification: jest.fn(() => Promise.resolve()),
- } as any as EmailAddressResource;
-
- render(
- ,
- );
-
- await waitFor(() => {
- expect(mockOnErrorHandler).toHaveBeenCalledWith('error');
- });
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP.tsx
deleted file mode 100644
index 341bd9f11ab..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { OneTimeCodeInput, VerifyCodeHandler } from '@clerk/shared/components/oneTimeCodeInput';
-import { noop } from '@clerk/shared/utils/noop';
-import { EmailAddressResource } from '@clerk/types';
-import React from 'react';
-import { useFieldState, verificationErrorMessage } from 'ui/common';
-
-type EmailAddressVerificationWithOTPProps = {
- email: EmailAddressResource;
- onVerificationComplete?: () => void;
- onError?: (err: any) => void;
- className?: string;
-};
-
-export function EmailAddressVerificationWithOTP({
- email,
- onError = noop,
- onVerificationComplete = noop,
- className,
-}: EmailAddressVerificationWithOTPProps): JSX.Element {
- const code = useFieldState('code', '');
-
- React.useEffect(() => {
- void prepareVerification();
- }, []);
-
- const prepareVerification = () => {
- return email.prepareVerification({ strategy: 'email_code' }).catch(onError);
- };
-
- const verifyCode: VerifyCodeHandler = (verify, reject) => {
- email
- .attemptVerification({ code: code.value })
- .then(() => verify(onVerificationComplete))
- .catch(e => {
- reject(verificationErrorMessage(e));
- });
- };
-
- return (
-
-
- An email containing a verification code has been sent to{' '}
- {email.emailAddress} .
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailDetail.test.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailDetail.test.tsx
deleted file mode 100644
index 40e267c0f40..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailDetail.test.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-import { render, renderJSON, screen, userEvent } from '@clerk/shared/testUtils';
-import { EmailAddressResource, EnvironmentResource, UserSettingsResource } from '@clerk/types';
-import { ClerkAPIResponseError } from 'core/resources/Error';
-import React from 'react';
-import { PartialDeep } from 'type-fest';
-
-import { EmailDetail } from './EmailDetail';
-
-const mockNavigate = jest.fn();
-const mockUseCoreUser = jest.fn();
-let mockFirstFactors = {} as PartialDeep;
-
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- params: { email_address_id: '1' },
- resolve: () => {
- return {
- toURL: {
- href: 'http://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-jest.mock('ui/contexts', () => {
- return {
- useCoreUser: () => mockUseCoreUser(),
- useEnvironment: jest.fn(
- () =>
- ({
- userSettings: mockFirstFactors,
- } as PartialDeep),
- ),
- useUserProfileContext: jest.fn(() => {
- return {
- routing: 'path',
- path: '/user',
- };
- }),
- };
-});
-
-describe(' ', () => {
- it('renders EmailDetail', async () => {
- mockUseCoreUser.mockImplementation(() => {
- return {
- primaryEmailAddressId: '1',
- emailAddresses: [
- {
- id: '1',
- email_address: 'clerk1@clerk.dev',
- verification: { status: 'verified' },
- linkedTo: [],
- attemptVerificationWithMagicLink: jest.fn(),
- },
- ],
- };
- });
-
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('displays verification errors', async () => {
- mockFirstFactors = {
- attributes: {
- email_address: {
- used_for_first_factor: true,
- first_factors: ['email_code'],
- },
- },
- };
- mockUseCoreUser.mockImplementation(() => {
- return {
- primaryEmailAddressId: '1',
- emailAddresses: [
- {
- id: '1',
- email_address: 'clerk1@clerk.dev',
- verification: { status: 'unverified' },
- linkedTo: [],
- attemptVerificationWithMagicLink: jest.fn(),
- prepareVerification: async () => {
- return null;
- },
- attemptVerification: async ({ code }: { code: string }) => {
- if (code === '999999') {
- throw new ClerkAPIResponseError('the-error', {
- data: [
- {
- code: 'the-code',
- message: 'the-short-message',
- long_message: 'the-long-error-message',
- },
- ],
- status: 422,
- });
- }
- return null;
- },
- } as any as EmailAddressResource,
- ],
- };
- });
- render( );
- // Type a verification code that will throw an error,
- // in this case '999999'.
- userEvent.type(screen.getByLabelText('Enter verification code. Digit 1'), '9');
- userEvent.type(screen.getByLabelText('Digit 2'), '9');
- userEvent.type(screen.getByLabelText('Digit 3'), '9');
- userEvent.type(screen.getByLabelText('Digit 4'), '9');
- userEvent.type(screen.getByLabelText('Digit 5'), '9');
- userEvent.type(screen.getByLabelText('Digit 6'), '9');
-
- expect(await screen.findByText('the-long-error-message')).toBeInTheDocument();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailDetail.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailDetail.tsx
deleted file mode 100644
index 714f488013a..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailDetail.tsx
+++ /dev/null
@@ -1,176 +0,0 @@
-// @ts-ignore
-import { default as BinIcon } from '@clerk/shared/assets/icons/bin.svg';
-// @ts-ignore
-import { default as MailIcon } from '@clerk/shared/assets/icons/mail.svg';
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { VerificationStatusTag } from '@clerk/shared/components/tag';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { Toggle } from '@clerk/shared/components/toggle';
-import React from 'react';
-import { handleError } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { useRouter } from 'ui/router';
-import { EmailAddressVerificationWithMagicLink } from 'ui/userProfile/emailAdressess/EmailAddressVerificationWithMagicLink';
-import { EmailAddressVerificationWithOTP } from 'ui/userProfile/emailAdressess/EmailAddressVerificationWithOTP';
-import { magicLinksEnabledForInstance } from 'ui/userProfile/emailAdressess/utils';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-import { EditableListFieldRemoveCard } from '../EditableListFieldRemoveCard';
-import { Connections, PrimaryTag } from '../util';
-
-export function EmailDetail(): JSX.Element | null {
- const environment = useEnvironment();
- const { navigate } = useNavigate();
- const user = useCoreUser();
- const { params } = useRouter();
- const [showRemovalPage, setShowRemovalPage] = React.useState(false);
- const [error, setError] = React.useState();
-
- const email = user.emailAddresses.find(ea => ea.id === params.email_address_id);
-
- const isPrimary = email?.id === user.primaryEmailAddressId;
-
- if (!email) {
- return null;
- }
-
- const verificationStatus = email.verification?.status || 'unverified';
- const isVerified = verificationStatus === 'verified';
-
- const handleRemove = () => {
- setShowRemovalPage(true);
- };
-
- const onEmailAddressRemove = () => {
- return email.destroy();
- };
-
- const makeIdentPrimary = async () => {
- user.update({ primaryEmailAddressId: email.id }).catch(e => handleError(e, [], setError));
- };
-
- const onErrorHandler = (e: any) => {
- handleError(e, [], setError);
- };
-
- const removeEmailAddressScreen = (
- {
- setShowRemovalPage(false);
- }}
- onRemove={onEmailAddressRemove}
- onRemoved={() => {
- navigate('../');
- }}
- />
- );
-
- return (
- <>
-
- {showRemovalPage && removeEmailAddressScreen}
- {!showRemovalPage && (
-
-
- {error}
-
-
-
-
-
-
- {email.emailAddress}
-
-
-
-
-
-
-
-
- {isVerified && (
-
-
-
-
-
-
Primary email
-
This email will receive communications regarding your account.
-
-
-
-
-
- )}
- {!isVerified && (
-
- {magicLinksEnabledForInstance(environment) ? (
-
- ) : (
-
- )}
-
- )}
-
-
-
- Remove
-
-
- )}
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailList.test.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailList.test.tsx
deleted file mode 100644
index 50ac428c73c..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailList.test.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { EmailAddressResource, UserResource } from '@clerk/types';
-import React from 'react';
-
-import { EmailList } from './EmailList';
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- primaryEmailAddressId: '1',
- emailAddresses: [
- {
- id: '1',
- email_address: 'clerk1@clerk.dev',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as EmailAddressResource,
- {
- id: '21',
- email_address: 'clerk2@clerk.dev',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as EmailAddressResource,
- ],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the list', async () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailList.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailList.tsx
deleted file mode 100644
index 01cbc114318..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/EmailList.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { VerificationStatusTag } from '@clerk/shared/components/tag';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { EmailAddressResource } from '@clerk/types';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-import { useRouter } from 'ui/router';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-import { Connections, PrimaryTag } from '../util';
-
-type EmailListItemProps = {
- emailAddress: EmailAddressResource;
- handleClick: () => any | undefined;
- isPrimary: boolean;
-};
-
-function EmailListItem({ emailAddress, handleClick, isPrimary }: EmailListItemProps): JSX.Element {
- const status = emailAddress.verification.status || 'unverified';
-
- return (
-
-
- {emailAddress.emailAddress}{' '}
-
-
-
-
- );
-}
-
-export function EmailList(): JSX.Element {
- const user = useCoreUser();
- const router = useRouter();
-
- const emailItems = user.emailAddresses.map(ea => (
- router.navigate(ea.id)}
- isPrimary={user.primaryEmailAddressId === ea.id}
- />
- ));
-
- return (
- <>
-
-
- {user.emailAddresses.length > 0 && {emailItems}
}
- {user.emailAddresses.length === 0 && No email addresses to display
}
- router.navigate('add')}
- className='cl-add-resource-button'
- type='button'
- flavor='text'
- buttonColor='primary'
- hoverable
- >
- Add email address
-
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/AddNewEmail.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/AddNewEmail.test.tsx.snap
deleted file mode 100644
index ce1f1cdd87d..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/AddNewEmail.test.tsx.snap
+++ /dev/null
@@ -1,129 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the AddNewEmail 1`] = `
-Array [
- ,
-
-
-
- Add email
-
-
- Enter an email address to add
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailAddressVerificationWithMagicLink.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailAddressVerificationWithMagicLink.test.tsx.snap
deleted file mode 100644
index ee3f0786f01..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailAddressVerificationWithMagicLink.test.tsx.snap
+++ /dev/null
@@ -1,45 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the component 1`] = `
-
-
-
-
-
- Check your email
-
-
- A verification link has been sent to
-
-
- boss@clerk.dev
-
-
-
- Click the link in the email to verify your new email, then return to
- this tab.
-
-
- Resend magic link
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailAddressVerificationWithOTP.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailAddressVerificationWithOTP.test.tsx.snap
deleted file mode 100644
index 699515eaea5..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailAddressVerificationWithOTP.test.tsx.snap
+++ /dev/null
@@ -1,145 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the component 1`] = `
-
-
- An email containing a verification code has been sent to
-
-
- boss@clerk.dev
-
- .
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailDetail.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailDetail.test.tsx.snap
deleted file mode 100644
index 6e173b38fde..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailDetail.test.tsx.snap
+++ /dev/null
@@ -1,150 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders EmailDetail 1`] = `
-Array [
-
-
-
-
-
-
- Email
-
-
- Manage this email address
-
-
-
,
-
-
-
-
-
-
-
-
-
- Primary
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Primary email
-
-
- This email will receive communications regarding your account.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Remove
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailList.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailList.test.tsx.snap
deleted file mode 100644
index 2bc92f50a26..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/__snapshots__/EmailList.test.tsx.snap
+++ /dev/null
@@ -1,121 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the list 1`] = `
-Array [
-
-
-
-
-
-
- Emails
-
-
- Manage addresses associated with your account
-
-
-
,
-
-
-
-
-
-
-
-
-
- Primary
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Add email address
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/index.tsx b/packages/clerk-js/src/ui/userProfile/emailAdressess/index.tsx
deleted file mode 100644
index 000c8d050e8..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/index.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import React from 'react';
-import { Route } from 'ui/router';
-
-import { AddNewEmail } from './AddNewEmail';
-import { EmailDetail } from './EmailDetail';
-import { EmailList } from './EmailList';
-
-export { AddNewEmail, EmailDetail, EmailList };
-
-export function EmailAddressesRoutes(): JSX.Element {
- return (
-
-
-
-
-
-
-
-
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/emailAdressess/utils.ts b/packages/clerk-js/src/ui/userProfile/emailAdressess/utils.ts
deleted file mode 100644
index 7245212ffc3..00000000000
--- a/packages/clerk-js/src/ui/userProfile/emailAdressess/utils.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { EnvironmentResource } from '@clerk/types';
-
-export function magicLinksEnabledForInstance(env: EnvironmentResource): boolean {
- const { userSettings } = env;
- const { email_address } = userSettings.attributes;
- return email_address.enabled && email_address.verifications.includes('email_link');
-}
diff --git a/packages/clerk-js/src/ui/userProfile/name/FirstName.test.tsx b/packages/clerk-js/src/ui/userProfile/name/FirstName.test.tsx
deleted file mode 100644
index 00c260e9024..00000000000
--- a/packages/clerk-js/src/ui/userProfile/name/FirstName.test.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { FirstName } from './FirstName';
-
-const mockNavigate = jest.fn();
-
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- firstName: 'John',
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the FirstName', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/name/FirstName.tsx b/packages/clerk-js/src/ui/userProfile/name/FirstName.tsx
deleted file mode 100644
index 3b56dda9cff..00000000000
--- a/packages/clerk-js/src/ui/userProfile/name/FirstName.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import { EditableField } from 'ui/userProfile/EditableField';
-
-export function FirstName(): JSX.Element {
- return (
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/name/LastName.test.tsx b/packages/clerk-js/src/ui/userProfile/name/LastName.test.tsx
deleted file mode 100644
index 2c35c1b04e3..00000000000
--- a/packages/clerk-js/src/ui/userProfile/name/LastName.test.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { LastName } from './LastName';
-
-const mockNavigate = jest.fn();
-
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- lastName: 'John',
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the LastName', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/name/LastName.tsx b/packages/clerk-js/src/ui/userProfile/name/LastName.tsx
deleted file mode 100644
index 98230ee8f59..00000000000
--- a/packages/clerk-js/src/ui/userProfile/name/LastName.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import { EditableField } from 'ui/userProfile/EditableField';
-
-export function LastName(): JSX.Element {
- return (
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/name/__snapshots__/FirstName.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/name/__snapshots__/FirstName.test.tsx.snap
deleted file mode 100644
index 713f68a09e4..00000000000
--- a/packages/clerk-js/src/ui/userProfile/name/__snapshots__/FirstName.test.tsx.snap
+++ /dev/null
@@ -1,97 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the FirstName 1`] = `
-Array [
-
-
-
-
-
-
- First name
-
-
- Edit your first name
-
-
-
,
- ,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/name/__snapshots__/LastName.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/name/__snapshots__/LastName.test.tsx.snap
deleted file mode 100644
index a209d96e3c4..00000000000
--- a/packages/clerk-js/src/ui/userProfile/name/__snapshots__/LastName.test.tsx.snap
+++ /dev/null
@@ -1,97 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the LastName 1`] = `
-Array [
-
-
-
-
-
-
- Last name
-
-
- Edit your last name
-
-
-
,
- ,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/name/index.tsx b/packages/clerk-js/src/ui/userProfile/name/index.tsx
deleted file mode 100644
index 3538e6356af..00000000000
--- a/packages/clerk-js/src/ui/userProfile/name/index.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react';
-import { Route } from 'ui/router';
-
-import { FirstName } from './FirstName';
-import { LastName } from './LastName';
-
-export { FirstName, LastName };
-
-export function NameRoutes(): JSX.Element {
- return (
- <>
-
-
-
-
-
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/pageHeading/PageHeading.test.tsx b/packages/clerk-js/src/ui/userProfile/pageHeading/PageHeading.test.tsx
deleted file mode 100644
index 8f79127ed2a..00000000000
--- a/packages/clerk-js/src/ui/userProfile/pageHeading/PageHeading.test.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import * as React from 'react';
-
-import { PageHeading } from './PageHeading';
-
-jest.mock('ui/router/RouteContext');
-
-describe(' ', () => {
- it('renders the header component', () => {
- const tree = renderJSON(
- ,
- );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/pageHeading/PageHeading.tsx b/packages/clerk-js/src/ui/userProfile/pageHeading/PageHeading.tsx
deleted file mode 100644
index dd3b07da194..00000000000
--- a/packages/clerk-js/src/ui/userProfile/pageHeading/PageHeading.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Heading } from '@clerk/shared/components/heading';
-import cn from 'classnames';
-import React from 'react';
-import { BackButton } from 'ui/common/backButton';
-
-export type PageHeadingProps = {
- title: string;
- subtitle?: string;
- backTo?: string;
- className?: string;
-};
-
-export function PageHeading({ title, subtitle, backTo, className }: PageHeadingProps): JSX.Element {
- return (
-
- {backTo && (
-
- )}
-
-
- {title}
-
-
{subtitle}
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/pageHeading/__snapshots__/PageHeading.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/pageHeading/__snapshots__/PageHeading.test.tsx.snap
deleted file mode 100644
index 4bea23ac405..00000000000
--- a/packages/clerk-js/src/ui/userProfile/pageHeading/__snapshots__/PageHeading.test.tsx.snap
+++ /dev/null
@@ -1,31 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the header component 1`] = `
-
-
-
-
-
-
- title
-
-
- subtitle
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/pageHeading/index.ts b/packages/clerk-js/src/ui/userProfile/pageHeading/index.ts
deleted file mode 100644
index d3cee7ec22f..00000000000
--- a/packages/clerk-js/src/ui/userProfile/pageHeading/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './PageHeading';
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/AddNewPhone.test.tsx b/packages/clerk-js/src/ui/userProfile/phoneNumbers/AddNewPhone.test.tsx
deleted file mode 100644
index 8788d5d018f..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/AddNewPhone.test.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { PhoneNumberResource, UserResource } from '@clerk/types';
-import React from 'react';
-
-import { AddNewPhone } from './AddNewPhone';
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- params: { email_address_id: '1' },
- resolve: () => {
- return {
- toURL: {
- href: 'http://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- primaryPhoneNumberId: '1',
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: '1234',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as PhoneNumberResource,
- ],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the AddNewPhone', async () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/AddNewPhone.tsx b/packages/clerk-js/src/ui/userProfile/phoneNumbers/AddNewPhone.tsx
deleted file mode 100644
index 3b2ff8afc06..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/AddNewPhone.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-import { AddVerifiableField } from 'ui/userProfile/AddVerifiableField';
-
-export const AddNewPhone = (): JSX.Element => {
- const user = useCoreUser();
- return (
-
- A text message with a verification code will be sent to your phone number.
- Standard carrier SMS and data fees may apply.
- >
- ),
- 1: 'A text message with a verification code has been sent to',
- 2: (
- <>
- has successfully been added to your account. You can now receive communications on this phone number.
- Standard carrier SMS and data fees may apply.
- >
- ),
- }}
- onAdd={(value: string) => user.createPhoneNumber({ phoneNumber: value })}
- />
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneDetail.test.tsx b/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneDetail.test.tsx
deleted file mode 100644
index 352e00f12f6..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneDetail.test.tsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import { render, renderJSON, screen, userEvent } from '@clerk/shared/testUtils';
-import { PhoneNumberResource } from '@clerk/types';
-import { ClerkAPIResponseError } from 'core/resources/Error';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts/CoreUserContext';
-
-import { PhoneDetail } from './PhoneDetail';
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- params: { phone_number_id: '1' },
- resolve: () => {
- return {
- toURL: {
- href: 'http://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: jest.fn(),
- };
-});
-
-describe(' ', () => {
- it('renders the list', async () => {
- (useCoreUser as jest.Mock).mockImplementation(() => {
- return {
- primaryEmailAddressId: '1',
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: '1234',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as PhoneNumberResource,
- ],
- };
- });
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- fit('displays verification errors', async () => {
- (useCoreUser as jest.Mock).mockImplementation(() => {
- return {
- primaryEmailAddressId: '1',
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: 'clerk1@clerk.dev',
- verification: { status: 'unverified' },
- linkedTo: [],
- prepareVerification: async () => {
- return null;
- },
- attemptVerification: async ({ code }: { code: string }) => {
- if (code === '999999') {
- throw new ClerkAPIResponseError('the-error', {
- data: [
- {
- code: 'the-code',
- message: 'the-short-message',
- long_message: 'the-long-error-message',
- },
- ],
- status: 422,
- });
- }
- return null;
- },
- } as any as PhoneNumberResource,
- ],
- };
- });
- render( );
- // Type a verification code that will throw an error,
- // in this case '999999'.
- userEvent.type(screen.getByLabelText('Enter verification code. Digit 1'), '9');
- userEvent.type(screen.getByLabelText('Digit 2'), '9');
- userEvent.type(screen.getByLabelText('Digit 3'), '9');
- userEvent.type(screen.getByLabelText('Digit 4'), '9');
- userEvent.type(screen.getByLabelText('Digit 5'), '9');
- userEvent.type(screen.getByLabelText('Digit 6'), '9');
-
- expect(await screen.findByText('the-long-error-message')).toBeInTheDocument();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneDetail.tsx b/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneDetail.tsx
deleted file mode 100644
index 06584d7ffd1..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneDetail.tsx
+++ /dev/null
@@ -1,207 +0,0 @@
-// @ts-ignore
-import { default as BinIcon } from '@clerk/shared/assets/icons/bin.svg';
-// @ts-ignore
-import { default as PhoneIcon } from '@clerk/shared/assets/icons/phone.svg';
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { OneTimeCodeInput, VerifyCodeHandler } from '@clerk/shared/components/oneTimeCodeInput';
-import { PhoneViewer } from '@clerk/shared/components/phoneInput';
-import { VerificationStatusTag } from '@clerk/shared/components/tag';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { Toggle } from '@clerk/shared/components/toggle';
-import React from 'react';
-import { handleError, useFieldState, verificationErrorMessage } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { useRouter } from 'ui/router';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-import { EditableListFieldRemoveCard } from '../EditableListFieldRemoveCard';
-import { PrimaryTag } from '../util';
-
-export const PhoneDetail = (): JSX.Element => {
- const { navigate } = useNavigate();
- const user = useCoreUser();
- const { params } = useRouter();
- const [showRemovalPage, setShowRemovalPage] = React.useState(false);
- const [isPrimary, setIsPrimary] = React.useState(false);
- const currentCode = useFieldState('', '');
- const [error, setError] = React.useState();
-
- const phoneIdent = user.phoneNumbers.find(pi => pi.id === params.phone_number_id);
-
- const verificationStatus = phoneIdent?.verification?.status || 'unverified';
- const isVerified = verificationStatus === 'verified';
-
- // TODO: we need this because updating the user obj
- // does not trigger a rerender through the context. Please discuss
- React.useLayoutEffect(() => {
- setIsPrimary(phoneIdent?.id === user?.primaryPhoneNumberId);
- }, []);
-
- React.useEffect(() => {
- if (!phoneIdent || isVerified) {
- return;
- }
- void sendVerificationCode();
- }, []);
-
- if (phoneIdent === undefined) {
- // TODO Braden: 404 here?
- return <>>;
- }
-
- const handleRemove = () => {
- setShowRemovalPage(true);
- };
-
- const onPhoneNumberRemove = () => {
- return phoneIdent.destroy();
- };
-
- const sendVerificationCode = async () => {
- try {
- await phoneIdent?.prepareVerification();
- } catch (err) {
- handleError(err, [currentCode], setError);
- }
- };
-
- const verifyCode: VerifyCodeHandler = async (verify, reject) => {
- try {
- await phoneIdent?.attemptVerification({ code: currentCode.value });
- verify(() => currentCode.setValue(''));
- } catch (err) {
- reject(verificationErrorMessage(err));
- }
- };
-
- const makeIdentPrimary = async () => {
- try {
- await user.update({ primaryPhoneNumberId: phoneIdent?.id });
- setIsPrimary(true);
- } catch (err) {
- handleError(err, [currentCode], setError);
- }
- };
-
- const otpInput = (
-
- );
-
- const connections = phoneIdent.linkedTo.map(connection => (
-
- Connected to {connection.type}
-
- ));
-
- const removalPage = (
- {
- setShowRemovalPage(false);
- }}
- onRemove={onPhoneNumberRemove}
- onRemoved={() => {
- navigate('../');
- }}
- />
- );
-
- return (
- <>
-
- {showRemovalPage ? (
- removalPage
- ) : (
-
-
- {error}
-
-
-
-
-
-
-
- {isVerified && (
-
-
-
-
-
-
Primary phone
-
This phone will receive communications regarding your account.
-
-
-
-
-
- )}
-
- {!isVerified && otpInput}
-
-
- Remove
-
-
- )}
- >
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneList.test.tsx b/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneList.test.tsx
deleted file mode 100644
index 381a2c1b164..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneList.test.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { PhoneNumberResource, UserResource } from '@clerk/types';
-import React from 'react';
-
-import { PhoneList } from './PhoneList';
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- primaryEmailAddressId: '1',
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: '1234',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as PhoneNumberResource,
- {
- id: '21',
- phoneNumber: '123',
- verification: { status: 'verified' },
- linkedTo: [],
- } as any as PhoneNumberResource,
- ],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the list', async () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneList.tsx b/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneList.tsx
deleted file mode 100644
index 039caac644b..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/PhoneList.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { PhoneViewer } from '@clerk/shared/components/phoneInput';
-import { Tag, VerificationStatusTag } from '@clerk/shared/components/tag';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { PhoneNumberResource } from '@clerk/types';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-import { useRouter } from 'ui/router';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-export const PhoneList = (): JSX.Element => {
- const user = useCoreUser();
- const router = useRouter();
-
- const createPhoneListItem = (phone: PhoneNumberResource) => {
- const verificationStatus = phone.verification.status || 'unverified';
- const isPrimary = user.primaryPhoneNumber?.id === phone.id;
- const primaryTag = isPrimary ? (
-
- Primary
-
- ) : null;
-
- const connections = phone.linkedTo.map(connection => (
-
- Connected to {connection.type}
-
- ));
-
- return (
- router.navigate(phone.id)}
- key={phone.id}
- >
-
-
-
- {primaryTag}
-
-
- {connections}
-
-
- );
- };
-
- return (
- <>
-
-
- {user.phoneNumbers.length > 0 && {user.phoneNumbers.map(createPhoneListItem)}
}
- {user.phoneNumbers.length === 0 && No phone numbers to display
}
- router.navigate('add')}
- className='cl-add-resource-button'
- type='button'
- flavor='text'
- buttonColor='primary'
- hoverable
- >
- Add phone number
-
-
- >
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/AddNewPhone.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/AddNewPhone.test.tsx.snap
deleted file mode 100644
index 592ef5830b2..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/AddNewPhone.test.tsx.snap
+++ /dev/null
@@ -1,2521 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the AddNewPhone 1`] = `
-Array [
- ,
-
-
-
- Add phone
-
-
- Enter a phone number to add
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/PhoneDetail.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/PhoneDetail.test.tsx.snap
deleted file mode 100644
index b0e16df3d94..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/PhoneDetail.test.tsx.snap
+++ /dev/null
@@ -1,158 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the list 1`] = `
-Array [
-
-
-
-
-
-
- Phone number
-
-
- Manage this phone number
-
-
-
,
-
-
-
-
-
-
-
-
-
- 🇺🇸
-
- +
- 1
-
- (123) 4
-
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Primary phone
-
-
- This phone will receive communications regarding your account.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Remove
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/PhoneList.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/PhoneList.test.tsx.snap
deleted file mode 100644
index cd5be69a8a3..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/__snapshots__/PhoneList.test.tsx.snap
+++ /dev/null
@@ -1,130 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the list 1`] = `
-Array [
-
-
-
-
-
-
- Phone numbers
-
-
- Manage phone numbers associated with your account
-
-
-
,
-
-
-
-
-
-
-
- +
- 1
-
- (123) 4
-
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- +
- 1
-
- 123
-
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
- Add phone number
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/phoneNumbers/index.tsx b/packages/clerk-js/src/ui/userProfile/phoneNumbers/index.tsx
deleted file mode 100644
index 2cab556aca9..00000000000
--- a/packages/clerk-js/src/ui/userProfile/phoneNumbers/index.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import React from 'react';
-import { Route } from 'ui/router';
-
-import { AddNewPhone } from './AddNewPhone';
-import { PhoneDetail } from './PhoneDetail';
-import { PhoneList } from './PhoneList';
-
-export { AddNewPhone, PhoneDetail, PhoneList };
-
-export const PhoneNumbersRoutes = (): JSX.Element => {
- return (
-
-
-
-
-
-
-
-
-
-
-
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/security/ActiveMethodsCard.test.tsx b/packages/clerk-js/src/ui/userProfile/security/ActiveMethodsCard.test.tsx
deleted file mode 100644
index 348ceb2d99e..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/ActiveMethodsCard.test.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { PhoneNumberResource, UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { ActiveMethodsCard } from './ActiveMethodsCard';
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- twoFactorEnabled: true,
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: '123123',
- verification: { status: 'verified' },
- reservedForSecondFactor: true,
- },
- ] as PhoneNumberResource[],
- };
- },
- };
-});
-
-it('renders the active methods card', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/ActiveMethodsCard.tsx b/packages/clerk-js/src/ui/userProfile/security/ActiveMethodsCard.tsx
deleted file mode 100644
index 71b3cffd873..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/ActiveMethodsCard.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-// @ts-ignore
-import { default as BinIcon } from '@clerk/shared/assets/icons/bin.svg';
-// @ts-ignore
-import { default as CheckCircleIcon } from '@clerk/shared/assets/icons/check-circle.svg';
-import { List } from '@clerk/shared/components/list';
-import { Menu } from '@clerk/shared/components/menu';
-import { PhoneViewer } from '@clerk/shared/components/phoneInput';
-import { Popover } from '@clerk/shared/components/popover';
-import { Tag } from '@clerk/shared/components/tag';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { PhoneNumberResource } from '@clerk/types';
-import React, { useState } from 'react';
-import { handleError } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser } from 'ui/contexts';
-import { TwoStepMethod, TwoStepMethodsToDisplayDataMap } from 'ui/userProfile/security/twoStepVerificationTypes';
-
-export function ActiveMethodsCard(): JSX.Element | null {
- const [error, setError] = useState();
-
- const user = useCoreUser();
-
- const enabledPhoneNumbers = user.phoneNumbers
- .filter(ph => ph.verification.status === 'verified')
- .filter(ph => ph.reservedForSecondFactor);
-
- const subtitleMessage = user.twoFactorEnabled
- ? '2-step verification is currently enabled using these methods.'
- : '2-step verification is not enabled.';
-
- function onError(err: Error) {
- if (!err) {
- return;
- }
- handleError(err, [], setError);
- }
-
- return enabledPhoneNumbers.length === 0 ? null : (
-
- {error}
-
-
- {enabledPhoneNumbers.map(phone => (
-
- ))}
-
-
- );
-}
-
-function PhoneListItem({ phone, onError }: PhoneListItemProps): JSX.Element {
- const { title } = TwoStepMethodsToDisplayDataMap[TwoStepMethod.SMS];
-
- async function makeDefault() {
- try {
- await phone.makeDefaultSecondFactor();
- } catch (err) {
- onError(err);
- }
- }
-
- async function remove() {
- try {
- await phone.setReservedForSecondFactor({ reserved: false });
- } catch (err) {
- onError(err);
- }
- }
-
- return (
-
- }
- >
-
- {phone.defaultSecondFactor && Default }
-
- );
-}
-
-type PhoneListItemProps = {
- phone: PhoneNumberResource;
- onError: (err: Error) => void;
-};
-
-function Actions({ onMakeDefault, onRemove }: ActionsProps): JSX.Element {
- return (
-
- ,
- label: 'Make default',
- handleSelect: onMakeDefault,
- isDestructiveAction: false,
- },
- {
- icon: ,
- label: 'Remove method',
- handleSelect: onRemove,
- isDestructiveAction: true,
- },
- ]}
- />
-
- );
-}
-
-type ActionsProps = {
- onMakeDefault: () => void;
- onRemove: () => void;
-};
diff --git a/packages/clerk-js/src/ui/userProfile/security/AddMethodCard.test.tsx b/packages/clerk-js/src/ui/userProfile/security/AddMethodCard.test.tsx
deleted file mode 100644
index ca7a0fd12de..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/AddMethodCard.test.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import * as React from 'react';
-
-import { AddMethodCard } from './AddMethodCard';
-
-jest.mock('ui/contexts', () => {
- return {
- useCoreClerk: jest.fn(() => ({})),
- };
-});
-
-it('renders the add method card', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/AddMethodCard.tsx b/packages/clerk-js/src/ui/userProfile/security/AddMethodCard.tsx
deleted file mode 100644
index 876d444aaa1..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/AddMethodCard.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import React from 'react';
-import { useNavigate } from 'ui/hooks';
-import { TwoStepMethod, TwoStepMethodsToDisplayDataMap } from 'ui/userProfile/security/twoStepVerificationTypes';
-
-export function AddMethodCard(): JSX.Element {
- const { navigate } = useNavigate();
- const availableMethods = [TwoStepMethod.SMS];
-
- function buildAddMethodRow(method: TwoStepMethod): JSX.Element {
- const { buttonTitle, linkPath, note, title } = TwoStepMethodsToDisplayDataMap[method];
- return (
-
-
-
{note}
-
navigate(linkPath)}
- >
- {buttonTitle}
-
-
-
- );
- }
-
- return (
-
- {availableMethods.map(buildAddMethodRow)}
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/AddPhone.tsx b/packages/clerk-js/src/ui/userProfile/security/AddPhone.tsx
deleted file mode 100644
index 23b7ae6038b..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/AddPhone.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-import { Button } from '@clerk/shared/components/button';
-import { PhoneViewer } from '@clerk/shared/components/phoneInput';
-import { Radio } from '@clerk/shared/components/radio';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { PhoneNumberResource } from '@clerk/types';
-import React from 'react';
-import { handleError } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { Link } from 'ui/router';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-// This is a temp workaround to make the standalone version
-// of the security pages ( ) to work correctly
-// even when the account pages are not present
-// TODO: Properly handle routing during the components v2 epic
-type AddPhoneProps = {
- standAlone?: boolean;
-};
-
-export const AddPhone = ({ standAlone }: AddPhoneProps): JSX.Element => {
- const user = useCoreUser();
- const { navigate } = useNavigate();
- const [error, setError] = React.useState();
- const twoStepValidPhoneNumbers = React.useMemo(() => {
- return user.phoneNumbers.filter(ph => {
- return ph.verification.status === 'verified' && !ph.reservedForSecondFactor;
- });
- }, [user.phoneNumbers]);
- const [selectedPhone, setSelectedPhone] = React.useState(undefined);
-
- const onClickCancel = () => {
- navigate('../');
- };
-
- const onClickContinue = async () => {
- try {
- setError(undefined);
- await selectedPhone?.setReservedForSecondFactor({ reserved: !selectedPhone?.reservedForSecondFactor });
- navigate('../');
- } catch (err) {
- handleError(err, [], setError);
- }
- };
-
- const phoneRows = twoStepValidPhoneNumbers.map(phone => (
- setSelectedPhone(phone)}
- key={phone.id}
- className='cl-phone-select-row'
- role='button'
- tabIndex={0}
- >
- }
- />
-
- ));
- return (
- <>
-
-
- {error}
-
- {phoneRows}
- {!standAlone && (
-
- Add new number
-
- )}
- {standAlone && twoStepValidPhoneNumbers.length === 0 && (
- No phone numbers found.
- )}
- {standAlone && twoStepValidPhoneNumbers.length === 0 ? null : (
-
- A text message with a verification code will be sent to your phone number.
-
Standard carrier SMS and data fees may apply.
-
- )}
-
-
- Continue
-
-
- Cancel
-
-
-
- >
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/security/ChangePassword.test.tsx b/packages/clerk-js/src/ui/userProfile/security/ChangePassword.test.tsx
deleted file mode 100644
index befc0141e6d..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/ChangePassword.test.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { render, screen } from '@clerk/shared/testUtils';
-import { EnvironmentResource, UserResource } from '@clerk/types';
-import * as React from 'react';
-import { PartialDeep } from 'type-fest';
-import { useEnvironment } from 'ui/contexts';
-import { ChangePassword } from 'ui/userProfile/security/ChangePassword';
-
-jest.mock('ui/hooks', () => ({
- useNavigate: () => ({ navigate: jest.fn() }),
-}));
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/contexts', () => {
- return {
- useCoreUser: (): Partial => ({
- passwordEnabled: true,
- }),
- useEnvironment: jest.fn(),
- };
-});
-
-describe(' ', () => {
- afterEach(() => {
- jest.clearAllMocks();
- });
-
- it('renders the ChangePassword page with showing remove password cta', async () => {
- (useEnvironment as jest.Mock>).mockImplementation(() => ({
- userSettings: {
- attributes: {
- password: {
- enabled: true,
- },
- },
- },
- }));
-
- render( );
- expect(screen.getByText('Remove password')).toBeInTheDocument();
- });
-
- it('renders the ChangePassword page without showing remove password cta', async () => {
- (useEnvironment as jest.Mock>).mockImplementation(() => ({
- userSettings: {
- attributes: {
- password: {
- enabled: false,
- },
- },
- },
- }));
-
- render( );
- expect(screen.getByText('Remove password')).toBeInTheDocument();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/ChangePassword.tsx b/packages/clerk-js/src/ui/userProfile/security/ChangePassword.tsx
deleted file mode 100644
index 81121efc441..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/ChangePassword.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import { Control } from '@clerk/shared/components/control';
-import { Form } from '@clerk/shared/components/form';
-import { Input } from '@clerk/shared/components/input';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import React from 'react';
-import { handleError, useFieldState } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-export function ChangePassword(): JSX.Element {
- const user = useCoreUser();
- const { userSettings } = useEnvironment();
- const { attributes } = userSettings;
- const { navigate } = useNavigate();
-
- const password = useFieldState('password', '');
- const confirmPassword = useFieldState('confirmPassword', '');
- const [error, setError] = React.useState();
-
- const onClickUpdatePassword = async () => {
- if (password.value !== confirmPassword.value) {
- setError("Passwords don't match.");
- return;
- }
-
- try {
- await user.update({ password: password.value });
- navigate('../');
- } catch (err) {
- handleError(err, [password], setError);
- }
- };
-
- const showRemovePassword = user.passwordEnabled && !attributes.password.required;
-
- const onClickRemovePassword = async () => {
- try {
- await user.update({ password: '' });
- navigate('../');
- } catch (err) {
- setError('' + err);
- }
- };
-
- return (
- <>
-
-
- {error}
-
-
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActiveDevicesCard.test.tsx b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActiveDevicesCard.test.tsx
deleted file mode 100644
index 7dccd51f3e9..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActiveDevicesCard.test.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { SessionActivity, SessionWithActivitiesResource, UserResource } from '@clerk/types';
-import * as React from 'react';
-import { ActiveDevicesCard } from 'ui/userProfile/security/DevicesAndActivity/ActiveDevicesCard';
-
-const sessionWithActivities = {
- id: 'sess_id',
- lastActiveAt: new Date(),
- latestActivity: {
- browserName: 'Safari',
- browserVersion: '10',
- city: 'Athens',
- country: 'Greece',
- deviceType: 'Iphone',
- id: '123',
- ipAddress: '123.123.123.123',
- isMobile: false,
- } as any as SessionActivity,
-} as SessionWithActivitiesResource;
-
-jest.mock('ui/contexts', () => {
- return {
- withCoreUserGuard: (a: any) => a,
- useCoreSession: () => {
- return { id: 'sess1' };
- },
- useCoreUser: () => {
- return {
- getSessions: () => {
- return Promise.resolve([sessionWithActivities]);
- },
- } as UserResource;
- },
- };
-});
-
-describe(' ', () => {
- it('renders the component', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActiveDevicesCard.tsx b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActiveDevicesCard.tsx
deleted file mode 100644
index 0115ea253c5..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActiveDevicesCard.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { SessionWithActivitiesResource } from '@clerk/types';
-import React from 'react';
-import { useCoreSession, useCoreUser, withCoreUserGuard } from 'ui/contexts';
-import {
- ActivityListItem,
- ActivityListItemSkeleton,
-} from 'ui/userProfile/security/DevicesAndActivity/ActivityListItem';
-
-function ActiveDevicesCardBase(): JSX.Element | null {
- // TODO: do we need to keep 'session' just for the id?
- const session = useCoreSession();
- const user = useCoreUser();
- const [sessionsWithActivities, setSessionsWithActivities] = React.useState([]);
-
- React.useEffect(() => {
- user?.getSessions().then(sa => setSessionsWithActivities(sa));
- }, [user]);
-
- const currentSessionFirst = (a: SessionWithActivitiesResource) => (a.id === session.id ? -1 : 1);
-
- const sessionElements = sessionsWithActivities.length
- ? sessionsWithActivities.sort(currentSessionFirst).map(sa => (
-
- ))
- : null;
-
- return (
-
- {sessionElements ? sessionElements : }
-
- );
-}
-ActiveDevicesCardBase.displayName = 'ActiveDevicesCard';
-
-export const ActiveDevicesCard = withCoreUserGuard(ActiveDevicesCardBase);
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityDescription.test.tsx b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityDescription.test.tsx
deleted file mode 100644
index ab1cee254e7..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityDescription.test.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-import { render, renderJSON, screen } from '@clerk/shared/testUtils';
-import { SessionActivity } from '@clerk/types';
-import * as React from 'react';
-import { ActivityDescription } from 'ui/userProfile/security/DevicesAndActivity/ActivityDescription';
-
-const date = new Date('1/1/2021 18:00 GMT+2');
-
-describe(' ', () => {
- it('renders the component with activity fully completed', () => {
- const activity = {
- browserName: 'Safari',
- browserVersion: '10',
- city: 'Athens',
- country: 'Greece',
- deviceType: 'Iphone',
- id: '123',
- ipAddress: '123.123.123.123',
- isMobile: false,
- } as SessionActivity;
-
- render(
- ,
- );
-
- screen.getByText(/Safari/);
- screen.getByText(/Iphone/);
- screen.getByText(/This device/);
-
- screen.getByText(/Athens/);
- screen.getByText(/Greece/);
- screen.getByText(/123.123.123.123/);
-
- const tree = renderJSON(
- ,
- );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders the component with ip if location is empty', () => {
- const activity = {
- browserName: 'Safari',
- browserVersion: '10',
- deviceType: 'Iphone',
- id: '123',
- ipAddress: '123.123.123.123',
- isMobile: false,
- } as SessionActivity;
-
- render(
- ,
- );
-
- screen.getByText(/123.123.123.123/);
- screen.getByText(/This device/);
- const tree = renderJSON(
- ,
- );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders the component with empty activity', () => {
- const activity = {} as SessionActivity;
-
- render(
- ,
- );
-
- screen.getByText(/Web browser/);
- screen.getByText(/Desktop device/);
-
- const tree = renderJSON(
- ,
- );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityDescription.tsx b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityDescription.tsx
deleted file mode 100644
index 4f7c718e5ee..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityDescription.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { Tag } from '@clerk/shared/components/tag';
-import { formatRelative } from '@clerk/shared/utils/date';
-import { SessionActivity } from '@clerk/types';
-import React from 'react';
-
-export type ActivityDescriptionProps = {
- sessionActivity: SessionActivity;
- isCurrentSession: boolean;
- lastActiveAt: Date;
-};
-
-export function ActivityDescription({
- sessionActivity,
- isCurrentSession,
- lastActiveAt,
-}: ActivityDescriptionProps): JSX.Element {
- const { city, country, browserName, browserVersion, deviceType, ipAddress, isMobile } = sessionActivity;
-
- const title = deviceType ? deviceType : isMobile ? 'Mobile device' : 'Desktop device';
-
- const browser = `${browserName || ''} ${browserVersion || ''}`.trim() || 'Web browser';
-
- const location = [city || '', country || ''].filter(Boolean).join(', ').trim() || null;
-
- return (
-
-
- {title}
- {isCurrentSession && (
-
- This device
-
- )}
-
- {!!browser &&
{browser}
}
- {!!ipAddress &&
{ipAddress}
}
- {!!location &&
{location}
}
-
- {formatRelative(lastActiveAt || new Date(), new Date())}
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityIcon.test.tsx b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityIcon.test.tsx
deleted file mode 100644
index 9e6f719d2aa..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityIcon.test.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { render, renderJSON } from '@clerk/shared/testUtils';
-import { SessionActivity } from '@clerk/types';
-import * as React from 'react';
-import { ActivityIcon } from 'ui/userProfile/security/DevicesAndActivity/ActivityIcon';
-
-describe(' ', () => {
- it('renders the component', () => {
- const result = render( );
- expect(result).toBeDefined();
- });
-
- it('renders the mobile icon', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders the desktop icon', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityIcon.tsx b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityIcon.tsx
deleted file mode 100644
index 3151ec2008f..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityIcon.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-// @ts-ignore
-import { default as DesktopIcon } from '@clerk/shared/assets/icons/desktop.svg';
-// @ts-ignore
-import { default as MobileIcon } from '@clerk/shared/assets/icons/mobile.svg';
-import { SessionActivity } from '@clerk/types';
-import cn from 'classnames';
-import React from 'react';
-
-export function ActivityIcon({ sessionActivity }: { sessionActivity: SessionActivity }): JSX.Element {
- return (
-
- {sessionActivity.isMobile ? : }
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityListItem.tsx b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityListItem.tsx
deleted file mode 100644
index c2ed0a61cb9..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/ActivityListItem.tsx
+++ /dev/null
@@ -1,139 +0,0 @@
-// @ts-ignore
-import { default as SignOutIcon } from '@clerk/shared/assets/icons/sign-out.svg';
-import { List } from '@clerk/shared/components/list';
-import { Menu } from '@clerk/shared/components/menu';
-import { Popover } from '@clerk/shared/components/popover';
-import { SkeletonLoader } from '@clerk/shared/components/skeletonLoader/SkeletonLoader';
-import { SessionWithActivitiesResource } from '@clerk/types';
-import { SessionResource } from '@clerk/types';
-import React from 'react';
-import { ActivityDescription } from 'ui/userProfile/security/DevicesAndActivity/ActivityDescription';
-import { ActivityIcon } from 'ui/userProfile/security/DevicesAndActivity/ActivityIcon';
-
-export function ActivityListItem(props: {
- sessionWithActivities: SessionWithActivitiesResource;
- currentSession: SessionResource | null | undefined;
-}): JSX.Element {
- const { latestActivity: sessionActivity, lastActiveAt, id } = props.sessionWithActivities;
- const isCurrentSession = id === props.currentSession?.id;
-
- return (
- }
- hoverable={false}
- detail={!isCurrentSession}
- detailIcon={
-
- }
- >
-
-
- );
-}
-
-function PopoverMenu(props: { isCurrent: boolean; sessionWithActivities: SessionWithActivitiesResource }) {
- if (props.isCurrent) {
- return null;
- }
-
- function revokeSession() {
- if (props.isCurrent || !props.sessionWithActivities) {
- return;
- }
- void props.sessionWithActivities.revoke();
- }
-
- return (
-
- ,
- label: Sign out on device ,
- handleSelect: revokeSession,
- isDestructiveAction: true,
- },
- ]}
- />
-
- );
-}
-
-export function ActivityListItemSkeleton(): JSX.Element {
- return (
-
-
-
-
-
- }
- >
-
-
-
-
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActiveDevicesCard.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActiveDevicesCard.test.tsx.snap
deleted file mode 100644
index 03a0b889c5b..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActiveDevicesCard.test.tsx.snap
+++ /dev/null
@@ -1,236 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the component 1`] = `
-
-
-
- Active devices
-
-
- Manage devices currently signed in to your account
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActivityDescription.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActivityDescription.test.tsx.snap
deleted file mode 100644
index 3c5005dcbe2..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActivityDescription.test.tsx.snap
+++ /dev/null
@@ -1,97 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the component with activity fully completed 1`] = `
-
-
- Iphone
-
- This device
-
-
-
- Safari 10
-
-
- 123.123.123.123
-
-
- Athens, Greece
-
-
- 1/1/2021
-
-
-`;
-
-exports[` renders the component with empty activity 1`] = `
-
-
- Desktop device
-
- This device
-
-
-
- Web browser
-
-
- 1/1/2021
-
-
-`;
-
-exports[` renders the component with ip if location is empty 1`] = `
-
-
- Iphone
-
- This device
-
-
-
- Safari 10
-
-
- 123.123.123.123
-
-
- 1/1/2021
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActivityIcon.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActivityIcon.test.tsx.snap
deleted file mode 100644
index c493400575b..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/DevicesAndActivity/__snapshots__/ActivityIcon.test.tsx.snap
+++ /dev/null
@@ -1,21 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the desktop icon 1`] = `
-
-
-
-`;
-
-exports[` renders the mobile icon 1`] = `
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/security/Security.test.tsx b/packages/clerk-js/src/ui/userProfile/security/Security.test.tsx
deleted file mode 100644
index 1f50e4dd966..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/Security.test.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import { mocked, render, renderJSON, screen } from '@clerk/shared/testUtils';
-import {
- EnvironmentResource,
- SessionActivity,
- SessionResource,
- SessionWithActivitiesResource,
- UserResource,
-} from '@clerk/types';
-import * as React from 'react';
-import { PartialDeep } from 'type-fest';
-
-import { useEnvironment } from '../../contexts';
-import { Security } from './Security';
-
-const sessionWithActivities: Partial = {
- id: 'sess_id',
- lastActiveAt: new Date(),
- latestActivity: {
- id: 'session_activity_1/',
- country: 'greece',
- isMobile: false,
- } as any as SessionActivity,
-};
-
-jest.mock('ui/contexts', () => {
- return {
- useEnvironment: jest.fn(),
- useCoreSession: () => {
- return { id: 'sess_id' } as SessionResource;
- },
- withCoreUserGuard: (a: any) => a,
- useCoreClerk: () => {
- return {
- navigate: jest.fn(),
- };
- },
- useCoreUser: () => {
- return {
- twoFactorEnabled: true,
- passwordEnabled: true,
- getSessions: () => {
- return Promise.resolve([sessionWithActivities]);
- },
- } as UserResource;
- },
- };
-});
-
-describe(' ', () => {
- afterEach(() => {
- jest.clearAllMocks();
- });
-
- it('renders the Security page with 2nd factor enabled', () => {
- mocked(useEnvironment as jest.Mock>, true).mockImplementation(
- () =>
- ({
- userSettings: {
- attributes: {
- phone_number: {
- used_for_second_factor: true,
- second_factors: ['phone_code'],
- },
- password: {
- enabled: true,
- },
- },
- },
- displayConfig: {
- branded: true,
- },
- } as PartialDeep),
- );
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('shows the password section when password is required', () => {
- mocked(useEnvironment as jest.Mock>, true).mockImplementation(
- () =>
- ({
- userSettings: {
- attributes: {
- phone_number: {
- used_for_second_factor: false,
- },
- password: {
- enabled: true,
- required: true,
- },
- },
- },
- } as PartialDeep),
- );
- render( );
- expect(screen.getByText('Password')).toBeInTheDocument();
- });
-
- it('hides the password section when password is not required', () => {
- mocked(useEnvironment as jest.Mock>, true).mockImplementation(
- () =>
- ({
- userSettings: {
- attributes: {
- phone_number: {
- used_for_second_factor: false,
- },
- password: {
- enabled: true,
- required: false,
- },
- },
- },
- } as PartialDeep),
- );
- render( );
- expect(screen.queryByText('Password')).not.toBeInTheDocument();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/Security.tsx b/packages/clerk-js/src/ui/userProfile/security/Security.tsx
deleted file mode 100644
index 4f7c90f8996..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/Security.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import React from 'react';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-import { ActiveDevicesCard } from './DevicesAndActivity/ActiveDevicesCard';
-
-export function Security(): JSX.Element {
- const { userSettings } = useEnvironment();
- const { attributes } = userSettings;
- const { navigate } = useNavigate();
- const user = useCoreUser();
-
- const showPasswordRow = attributes.password.enabled && attributes.password.required;
-
- const showSecondFactorRow =
- attributes.phone_number.used_for_second_factor && attributes.phone_number.second_factors.includes('phone_code');
-
- const buildPasswordRow = () => (
- navigate('password')}
- >
- {user.passwordEnabled ? (
- ••••••••••
- ) : (
- None
- )}
-
- );
-
- const buildSecondFactorRow = () => {
- const twoFacOn = user.twoFactorEnabled;
- return (
- navigate('two-step')}
- >
-
- Currently {twoFacOn ? 'ON' : 'OFF'}
- {twoFacOn && (
-
-
- An additional authentication step is required when signing in
-
- )}
-
-
- );
- };
-
- return (
- <>
-
- {(showPasswordRow || showSecondFactorRow) && (
-
-
- {showPasswordRow && buildPasswordRow()}
- {showSecondFactorRow && buildSecondFactorRow()}
-
-
- )}
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/TwoStepVerification.test.tsx b/packages/clerk-js/src/ui/userProfile/security/TwoStepVerification.test.tsx
deleted file mode 100644
index 3d6ecad6c7e..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/TwoStepVerification.test.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { PhoneNumberResource, UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { TwoStepVerification } from './TwoStepVerification';
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: jest.fn(),
- };
- },
-}));
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- twoFactorEnabled: true,
- phoneNumbers: [
- {
- id: '1',
- phoneNumber: '123123',
- verification: { status: 'verified' },
- reservedForSecondFactor: true,
- },
- ] as PhoneNumberResource[],
- };
- },
- };
-});
-
-it('renders ', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
-});
diff --git a/packages/clerk-js/src/ui/userProfile/security/TwoStepVerification.tsx b/packages/clerk-js/src/ui/userProfile/security/TwoStepVerification.tsx
deleted file mode 100644
index 599ed6629f8..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/TwoStepVerification.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from 'react';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-import { ActiveMethodsCard } from 'ui/userProfile/security/ActiveMethodsCard';
-
-import { AddMethodCard } from './AddMethodCard';
-
-export function TwoStepVerification(): JSX.Element {
- return (
- <>
-
-
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/ActiveMethodsCard.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/security/__snapshots__/ActiveMethodsCard.test.tsx.snap
deleted file mode 100644
index 7c7534175e5..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/ActiveMethodsCard.test.tsx.snap
+++ /dev/null
@@ -1,80 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders the active methods card 1`] = `
-
-
-
- Active methods
-
-
- 2-step verification is currently enabled using these methods.
-
-
-
-
-
- SMS code
-
-
-
-
- +
- 1
-
- (123) 123
-
-
-
-
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/AddMethodCard.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/security/__snapshots__/AddMethodCard.test.tsx.snap
deleted file mode 100644
index 7a54c1ec81d..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/AddMethodCard.test.tsx.snap
+++ /dev/null
@@ -1,58 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders the add method card 1`] = `
-
-
-
- Add method
-
-
- Set up a new 2-step verification method
-
-
-
-
-
- SMS code
-
-
-
-
-
- Receive a verification code via SMS when signing in
-
-
- Add SMS code verification
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/Security.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/security/__snapshots__/Security.test.tsx.snap
deleted file mode 100644
index 1a45e1aa615..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/Security.test.tsx.snap
+++ /dev/null
@@ -1,318 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the Security page with 2nd factor enabled 1`] = `
-Array [
-
-
-
- Security
-
-
- Manage settings related to account security
-
-
-
,
-
-
-
- Sign in
-
-
- Manage authentication settings
-
-
-
-
-
- 2-step verification
-
-
-
-
- Currently
-
- ON
-
-
-
- An additional authentication step is required when signing in
-
-
-
-
-
-
-
-
-
-
,
-
-
-
- Active devices
-
-
- Manage devices currently signed in to your account
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/TwoStepVerification.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/security/__snapshots__/TwoStepVerification.test.tsx.snap
deleted file mode 100644
index def50a75915..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/__snapshots__/TwoStepVerification.test.tsx.snap
+++ /dev/null
@@ -1,163 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders 1`] = `
-Array [
-
-
-
-
-
-
- 2-step verification
-
-
- Use a verification code when signing in from an unfamiliar device
-
-
-
,
-
-
-
- Active methods
-
-
- 2-step verification is currently enabled using these methods.
-
-
-
-
-
- SMS code
-
-
-
-
- +
- 1
-
- (123) 123
-
-
-
-
-
-
-
,
-
-
-
- Add method
-
-
- Set up a new 2-step verification method
-
-
-
-
-
- SMS code
-
-
-
-
-
- Receive a verification code via SMS when signing in
-
-
- Add SMS code verification
-
-
-
-
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/security/index.tsx b/packages/clerk-js/src/ui/userProfile/security/index.tsx
deleted file mode 100644
index fefdb41d87d..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/index.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import React from 'react';
-import { useEnvironment } from 'ui/contexts';
-import { Route } from 'ui/router';
-import { AddNewPhone } from 'ui/userProfile/phoneNumbers/AddNewPhone';
-
-import { AddPhone } from './AddPhone';
-import { ChangePassword } from './ChangePassword';
-import { Security } from './Security';
-import { TwoStepVerification } from './TwoStepVerification';
-
-export { AddPhone, ChangePassword, TwoStepVerification, Security };
-
-type SecurityRoutesProps = {
- standAlone?: boolean;
- index?: boolean;
-};
-
-export function SecurityRoutes({ standAlone = false, index = false }: SecurityRoutesProps): JSX.Element {
- const { userSettings } = useEnvironment();
- const {
- attributes: { phone_number, password },
- } = userSettings;
- const canActivate2svRoutes = () =>
- phone_number.used_for_second_factor && phone_number.second_factors.includes('phone_code');
- const canActivatePasswordRoutes = () => password.enabled && password.required;
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/security/twoStepVerificationTypes.ts b/packages/clerk-js/src/ui/userProfile/security/twoStepVerificationTypes.ts
deleted file mode 100644
index 7ee583e3e40..00000000000
--- a/packages/clerk-js/src/ui/userProfile/security/twoStepVerificationTypes.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-export enum TwoStepMethod {
- SMS = 0,
- Authenticator,
- SecurityKey,
- BackupCode,
-}
-
-export interface TwoStepMethodsDisplayData {
- title: string;
- note: string;
- buttonTitle: string;
- linkPath: string;
-}
-
-export const TwoStepMethodsToDisplayDataMap: Readonly> = Object.freeze(
- {
- [TwoStepMethod.SMS]: {
- title: 'SMS code',
- note: 'Receive a verification code via SMS when signing in',
- buttonTitle: 'Add SMS code verification',
- linkPath: 'add-phone',
- },
- [TwoStepMethod.Authenticator]: {
- title: 'Authenticator',
- note: 'Receive verification codes when you sign in on your authenticator app, even without an internet connection',
- buttonTitle: 'Add authenticator',
- linkPath: 'add-authenticator',
- },
- [TwoStepMethod.SecurityKey]: {
- title: 'Security Key',
- note: 'Use a physical security key when signing in. These can be built in to your phone, use Bluetooth, or plug directly into your computer’s USB port',
- buttonTitle: 'Add security key',
- linkPath: 'add-security-key',
- },
- [TwoStepMethod.BackupCode]: {
- title: 'Backup Code',
- note: 'Generate a new backup code in case you lose it or suspect it has been compromised',
- buttonTitle: 'Add backup code',
- linkPath: 'add-backup-code',
- },
- },
-);
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountDetail.test.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountDetail.test.tsx
deleted file mode 100644
index 23393d68b63..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountDetail.test.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import { render, renderJSON, screen, userEvent } from '@clerk/shared/testUtils';
-import type { ExternalAccountResource, UserResource } from '@clerk/types';
-import React from 'react';
-
-import { SocialAccountDetail } from './SocialAccountDetail';
-
-const mockFacebookDestroy = jest.fn();
-const mockGoogleDestroy = jest.fn();
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- id: 'user_1nQu4nZrhHEeolMMRhg4yERFYJx',
- username: null,
- firstName: 'Peter',
- lastName: 'Smith',
- externalAccounts: [
- {
- id: 'fbac_yolo',
- identificationId: 'ident_fb',
- provider: 'facebook',
- approvedScopes: 'email',
- avatarUrl: 'http://images.clerktest.host/avatar.png',
- emailAddress: 'peter@gmail.com',
- firstName: 'Peter',
- lastName: 'Smith',
- providerUserId: '10147951078263327',
- publicMetadata: {},
- verification: null,
- destroy: mockFacebookDestroy,
- providerSlug: () => 'facebook',
- providerTitle: () => 'Facebook',
- accountIdentifier: () => 'peter@gmail.com',
- } as ExternalAccountResource,
- {
- id: 'gac_swag',
- identificationId: 'ident_google',
- provider: 'google',
- approvedScopes:
- 'email https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid profile',
- avatarUrl: 'http://images.clerktest.host/avatar.png',
- emailAddress: 'peter@gmail.com',
- firstName: 'Peter',
- lastName: 'Smith',
- providerUserId: '112567347150540108741',
- publicMetadata: {},
- verification: null,
- destroy: mockGoogleDestroy,
- providerSlug: () => 'google',
- providerTitle: () => 'Google',
- accountIdentifier: () => 'peter@gmail.com',
- } as ExternalAccountResource,
- ],
- };
- },
- };
-});
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- params: { social_account_id: 'gac_swag' },
- resolve: () => {
- return {
- toURL: {
- href: 'http://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: jest.fn(() => {
- return {
- navigate: mockNavigate,
- };
- }),
-}));
-
-describe(' ', () => {
- it('Social Account Detail renders Google account', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('Unlink Google Social Account', () => {
- render( );
-
- userEvent.click(screen.getByText('Unlink'));
- userEvent.click(screen.getByText('Unlink social account', { selector: 'button' }));
- expect(mockGoogleDestroy).toHaveBeenCalled();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountDetail.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountDetail.tsx
deleted file mode 100644
index 2616a039faa..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountDetail.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-// @ts-ignore
-import { default as BinIcon } from '@clerk/shared/assets/icons/bin.svg';
-import { Avatar } from '@clerk/shared/components/avatar';
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { titleize } from '@clerk/shared/utils';
-import React from 'react';
-import { svgUrl } from 'ui/common/constants';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { useRouter } from 'ui/router';
-import { EditableListFieldRemoveCard } from 'ui/userProfile/EditableListFieldRemoveCard';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-export function SocialAccountDetail(): JSX.Element | null {
- const { navigate } = useNavigate();
- const user = useCoreUser();
- const { params } = useRouter();
- const [showRemovalPage, setShowRemovalPage] = React.useState(false);
-
- const externalAccount = user.externalAccounts.find(ea => ea.id === params.social_account_id);
-
- if (!externalAccount) {
- return null;
- }
-
- const handleRemove = () => {
- setShowRemovalPage(true);
- };
-
- const onExternalAccountRemove = () => {
- return externalAccount.destroy();
- };
-
- const avatarRow = (
-
-
-
- );
-
- const emailAddressRow = (
-
- {externalAccount.emailAddress}
-
- );
-
- const usernameRow = externalAccount.username ? (
-
- {externalAccount.username}
-
- ) : (
- <>>
- );
-
- const disconnectExternalAccountScreen = (
- {
- setShowRemovalPage(false);
- }}
- onRemove={onExternalAccountRemove}
- onRemoved={() => {
- navigate('../');
- }}
- />
- );
-
- return (
- <>
-
- {showRemovalPage && disconnectExternalAccountScreen}
- {!showRemovalPage && (
-
-
- {externalAccount.providerTitle()}
-
- }
- subtitle=' '
- className='cl-themed-card cl-list-card'
- >
-
- {avatarRow}
- {emailAddressRow}
- {usernameRow}
-
-
-
- Unlink
-
-
- )}
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountList.test.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountList.test.tsx
deleted file mode 100644
index 03fbe9ba098..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountList.test.tsx
+++ /dev/null
@@ -1,215 +0,0 @@
-import { render, renderJSON, screen, userEvent, waitFor } from '@clerk/shared/testUtils';
-import {
- ClerkAPIErrorJSON,
- ExternalAccountJSON,
- OAuthProviders,
- UserJSON,
- UserResource,
- UserSettingsJSON,
- UserSettingsResource,
- VerificationJSON,
-} from '@clerk/types';
-import { ExternalAccount, User } from 'core/resources';
-import { UserSettings } from 'core/resources/UserSettings';
-import React from 'react';
-
-import { SocialAccountList } from './SocialAccountList';
-
-const mockNavigate = jest.fn();
-
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-const mockUseEnvironment = jest.fn();
-
-const mockCreateExternalAccount = jest.fn();
-
-jest.mock('ui/contexts', () => {
- return {
- useCoreUser: (): Partial => {
- const user = new User({
- object: 'user',
- id: 'user_1nQu4nZrhHEeolMMRhg4yERFYJx',
- username: '',
- first_name: 'Peter',
- last_name: 'Smith',
- email_addresses: [],
- phone_numbers: [],
- web3_wallets: [],
- external_accounts: [
- {
- id: 'fbac_yolo',
- provider: 'facebook',
- approved_scopes: 'email',
- avatar_url: 'http://images.clerktest.host/avatar.png',
- email_address: 'peter@gmail.com',
- first_name: 'Peter',
- last_name: 'Smith',
- provider_user_id: '10147951078263327',
- verification: { status: 'verified' } as VerificationJSON,
- } as ExternalAccountJSON,
- {
- id: 'gac_swag',
- provider: 'google',
- approved_scopes:
- 'email https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid profile',
- avatar_url: 'http://images.clerktest.host/avatar.png',
- email_address: 'peter@gmail.com',
- first_name: 'Peter',
- last_name: 'Smith',
- provider_user_id: '112567347150540108741',
- verification: { status: 'verified' } as VerificationJSON,
- } as ExternalAccountJSON,
- {
- id: 'eac_heehee',
- provider: 'github',
- approved_scopes: '',
- avatar_url: '',
- email_address: '',
- first_name: '',
- last_name: '',
- provider_user_id: '',
- verification: {
- status: 'unverified',
- error: {
- long_message: 'Everything that could go wrong, did',
- } as ClerkAPIErrorJSON,
- } as VerificationJSON,
- } as ExternalAccountJSON,
- ],
- } as unknown as UserJSON);
-
- user.createExternalAccount = mockCreateExternalAccount;
-
- return user;
- },
- useEnvironment: () => mockUseEnvironment(),
- };
-});
-
-const environmentContext = {
- userSettings: new UserSettings({
- social: {
- oauth_google: {
- enabled: true,
- required: false,
- authenticatable: true,
- strategy: 'oauth_google',
- },
- oauth_facebook: {
- enabled: true,
- required: false,
- authenticatable: true,
- strategy: 'oauth_facebook',
- },
- oauth_github: {
- enabled: true,
- required: false,
- authenticatable: true,
- strategy: 'oauth_github',
- },
- oauth_microsoft: {
- enabled: true,
- required: false,
- authenticatable: true,
- strategy: 'oauth_microsoft',
- },
- oauth_bitbucket: {
- enabled: false,
- required: false,
- authenticatable: true,
- strategy: 'oauth_bitbucket',
- },
- oauth_discord: {
- enabled: false,
- required: false,
- authenticatable: true,
- strategy: 'oauth_bitbucket',
- },
- } as OAuthProviders,
- } as UserSettingsJSON) as UserSettingsResource,
-};
-
-const emptyEnvironmentContext = {
- userSettings: new UserSettings({
- social: {
- oauth_google: {
- enabled: false,
- required: false,
- authenticatable: true,
- strategy: 'oauth_google',
- },
- oauth_facebook: {
- enabled: false,
- required: false,
- authenticatable: true,
- strategy: 'oauth_facebook',
- },
- } as OAuthProviders,
- } as UserSettingsJSON) as UserSettingsResource,
-};
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- resolve: () => {
- return {
- toURL: {
- href: 'http://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-describe(' ', () => {
- beforeEach(() => {
- jest.clearAllMocks();
- });
-
- it('renders a list of Social Accounts', () => {
- mockUseEnvironment.mockImplementation(() => environmentContext);
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders an empty list if there are no enabled providers', () => {
- mockUseEnvironment.mockImplementation(() => emptyEnvironmentContext);
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('navigates to the external account verification URL when the users connects an oauth provider', async () => {
- mockUseEnvironment.mockImplementation(() => environmentContext);
-
- render( );
-
- mockCreateExternalAccount.mockImplementation(() => {
- return Promise.resolve(
- new ExternalAccount(
- {
- verification: {
- external_verification_redirect_url: 'https://www.foobar.com/',
- } as VerificationJSON,
- } as ExternalAccountJSON,
- '/external_accounts',
- ),
- );
- });
-
- const connectMSButton = screen.getByRole('button', { name: /Connect Microsoft account/ });
- userEvent.click(connectMSButton);
-
- await waitFor(() => {
- expect(mockNavigate).toHaveBeenCalledWith(new URL('https://www.foobar.com/'));
- });
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountList.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountList.tsx
deleted file mode 100644
index 8038f7b6034..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/SocialAccountList.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { ExternalAccountResource, OAuthProvider, OAuthStrategy } from '@clerk/types';
-import React, { useState } from 'react';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser, useEnvironment } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-import { UnconnectedAccountListItem } from './UnconnectedAccountListItem';
-import { UnverifiedAccountListItem } from './UnverifiedAccountListItem';
-import { VerifiedAccountListItem } from './VerifiedAccountListItem';
-
-export function SocialAccountList(): JSX.Element {
- return (
- <>
-
-
-
-
-
- >
- );
-}
-
-function SocialAccountListRows(): JSX.Element {
- const [error, setError] = useState();
- const [busyProvider, setBusyProvider] = useState(null);
- const user = useCoreUser();
- const { navigate } = useNavigate();
- const {
- userSettings: { social },
- } = useEnvironment();
-
- const availableProviders = Object.values(social).filter(oauthProvider => oauthProvider.enabled);
-
- const verifiedAccounts = user.verifiedExternalAccounts;
- const verifiedProviders = verifiedAccounts.map(externalAccount => externalAccount.provider);
-
- // To avoid visual clutter, filter out external accounts for which there is no error set (potentially abandoned flows)
- const unverifiedAccounts = user.unverifiedExternalAccounts.filter(
- externalAccount => !!externalAccount?.verification?.error,
- );
- const unverifiedProviders = unverifiedAccounts.map(externalAccount => externalAccount.provider);
-
- const unconnectedProviders = availableProviders.filter(oauthProvider => {
- const provider = oauthProvider.strategy.replace('oauth_', '') as OAuthProvider; // :-(
- return !verifiedProviders.includes(provider) && !unverifiedProviders.includes(provider);
- });
-
- const handleConnect = (strategy: OAuthStrategy) => {
- setError(undefined);
- setBusyProvider(strategy);
-
- user
- .createExternalAccount({ strategy: strategy, redirect_url: window.location.href })
- .then(externalAccount => {
- navigate(externalAccount.verification!.externalVerificationRedirectURL);
- })
- .catch(err => {
- setError(err.message || err);
- setBusyProvider(null);
- console.log(err);
- });
- };
-
- const handleDisconnect = (externalAccount: ExternalAccountResource) => {
- return externalAccount.destroy();
- };
-
- if (availableProviders.length == 0) {
- return There are no available external account providers
;
- }
-
- return (
- <>
- {error}
-
-
- {verifiedAccounts.map(externalAccount => (
-
- ))}
-
- {unverifiedAccounts.map(externalAccount => (
-
- ))}
-
- {unconnectedProviders.map(unconnectedProvider => (
-
- ))}
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/UnconnectedAccountListItem.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/UnconnectedAccountListItem.tsx
deleted file mode 100644
index 3e822fcfaf8..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/UnconnectedAccountListItem.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { ArrowRightIcon } from '@clerk/shared/assets/icons';
-import { List } from '@clerk/shared/components/list';
-import { Spinner } from '@clerk/shared/components/spinner';
-import { titleize } from '@clerk/shared/utils/string';
-import type { OAuthProvider, OAuthProviderSettings, OAuthStrategy } from '@clerk/types';
-import React from 'react';
-import { svgUrl } from 'ui/common/constants';
-
-type UnconnectedAccountListItemProps = {
- oauthProviderSettings: OAuthProviderSettings;
- handleConnect: (strategy: OAuthStrategy) => void;
- isBusy: boolean;
- isDisabled: boolean;
-};
-
-export function UnconnectedAccountListItem({
- oauthProviderSettings,
- handleConnect,
- isBusy,
- isDisabled,
-}: UnconnectedAccountListItemProps): JSX.Element {
- const oauthProvider = oauthProviderSettings.strategy.replace('oauth_', '') as OAuthProvider;
-
- return (
- handleConnect(oauthProviderSettings.strategy)}
- detailIcon={isBusy ? : }
- disabled={isDisabled}
- >
-
-
- Connect {titleize(oauthProvider)} account
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/UnverifiedAccountListItem.test.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/UnverifiedAccountListItem.test.tsx
deleted file mode 100644
index 2b0d3e6e467..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/UnverifiedAccountListItem.test.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { act, screen } from '@clerk/shared/testUtils';
-import { render, userEvent } from '@clerk/shared/utils/testUtils';
-import { ExternalAccountResource } from '@clerk/types';
-import React from 'react';
-
-import { UnverifiedAccountListItem } from './UnverifiedAccountListItem';
-
-const mockExternalAccount = {
- id: 'mock_id',
- provider: 'google',
- providerTitle: () => 'Google',
-} as ExternalAccountResource;
-const mockHandleConnect = jest.fn();
-const mockHandleDisconnect = jest.fn();
-
-describe(' ', () => {
- it('Disconnect unverified account', async () => {
- render(
- ,
- );
-
- await act(async () => {
- await userEvent.click(screen.getByRole('button', { expanded: false }));
- await userEvent.click(screen.getByText('Disconnect'));
- });
-
- expect(mockHandleDisconnect).toHaveBeenCalled();
- });
-
- it('Reconnect unverified account', async () => {
- render(
- ,
- );
-
- await act(async () => {
- await userEvent.click(screen.getByRole('button', { expanded: false }));
- await userEvent.click(screen.getByText('Reconnect'));
- });
-
- expect(mockHandleConnect).toHaveBeenCalled();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/UnverifiedAccountListItem.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/UnverifiedAccountListItem.tsx
deleted file mode 100644
index c0b8d45fc99..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/UnverifiedAccountListItem.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { Menu } from '@clerk/shared/components/menu';
-import { Popover } from '@clerk/shared/components/popover';
-import { Spinner } from '@clerk/shared/components/spinner';
-import { VerificationStatusTag } from '@clerk/shared/components/tag';
-import type { ExternalAccountResource } from '@clerk/types';
-import { OAuthStrategy } from '@clerk/types';
-import React from 'react';
-import { svgUrl } from 'ui/common/constants';
-
-type UnverifiedAccountListItemProps = {
- externalAccount: ExternalAccountResource;
- handleConnect: (strategy: OAuthStrategy) => void;
- handleDisconnect: (externalAccount: ExternalAccountResource) => void;
- isBusy: boolean;
- isDisabled: boolean;
-};
-
-export function UnverifiedAccountListItem({
- externalAccount,
- handleConnect,
- handleDisconnect,
- isBusy,
- isDisabled,
-}: UnverifiedAccountListItemProps): JSX.Element {
- const popoverMenu = (
-
- Reconnect,
- handleSelect: () => handleConnect(`oauth_${externalAccount.provider}`),
- },
- {
- label: Disconnect ,
- handleSelect: () => handleDisconnect(externalAccount),
- },
- ]}
- />
-
- );
-
- return (
- : popoverMenu}
- disabled={isDisabled}
- >
-
-
-
- {externalAccount.username || externalAccount.emailAddress}
-
- {externalAccount.label && ` (${externalAccount.label})`}
-
-
-
-
{externalAccount.verification?.error?.longMessage}
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/VerifiedAccountListItem.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/VerifiedAccountListItem.tsx
deleted file mode 100644
index 74a1766e034..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/VerifiedAccountListItem.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { List } from '@clerk/shared/components/list';
-import { VerificationStatusTag } from '@clerk/shared/components/tag';
-import type { ExternalAccountResource } from '@clerk/types';
-import React from 'react';
-import { svgUrl } from 'ui/common/constants';
-import { useNavigate } from 'ui/hooks';
-
-type VerifiedAccountListItemProps = {
- externalAccount: ExternalAccountResource;
- isDisabled: boolean;
-};
-
-export function VerifiedAccountListItem({ externalAccount, isDisabled }: VerifiedAccountListItemProps): JSX.Element {
- const { navigate } = useNavigate();
-
- return (
- navigate(externalAccount.id)}
- disabled={isDisabled}
- >
-
-
- {externalAccount.username || externalAccount.emailAddress}
-
- {externalAccount.label && ` (${externalAccount.label})`}
-
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/__snapshots__/SocialAccountDetail.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/socialAccounts/__snapshots__/SocialAccountDetail.test.tsx.snap
deleted file mode 100644
index 351904db3fc..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/__snapshots__/SocialAccountDetail.test.tsx.snap
+++ /dev/null
@@ -1,129 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` Social Account Detail renders Google account 1`] = `
-Array [
- ,
-
-
-
-
-
- Â
- Google
-
-
-
-
-
-
-
-
-
- Photo
-
-
-
-
-
-
-
-
-
-
-
-
- Unlink
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/__snapshots__/SocialAccountList.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/socialAccounts/__snapshots__/SocialAccountList.test.tsx.snap
deleted file mode 100644
index 0ef61ff9637..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/__snapshots__/SocialAccountList.test.tsx.snap
+++ /dev/null
@@ -1,238 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders a list of Social Accounts 1`] = `
-Array [
-
-
-
-
-
-
- Social accounts
-
-
-
-
,
-
-
-
-
-
-
-
- peter@gmail.com
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
- peter@gmail.com
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Unverified
-
-
- Everything that could go wrong, did
-
-
-
-
-
-
-
-
-
-
-
- Connect
- Microsoft
- account
-
-
-
-
-
-
-
,
-]
-`;
-
-exports[` renders an empty list if there are no enabled providers 1`] = `
-Array [
-
-
-
-
-
-
- Social accounts
-
-
-
-
,
-
-
- There are no available external account providers
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/socialAccounts/index.tsx b/packages/clerk-js/src/ui/userProfile/socialAccounts/index.tsx
deleted file mode 100644
index dd4ce9a3971..00000000000
--- a/packages/clerk-js/src/ui/userProfile/socialAccounts/index.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react';
-import { Route } from 'ui/router';
-
-import { SocialAccountDetail } from './SocialAccountDetail';
-import { SocialAccountList } from './SocialAccountList';
-
-export { SocialAccountList, SocialAccountDetail };
-
-export const SocialAccountsRoutes = (): JSX.Element => {
- return (
-
-
-
-
-
-
-
-
- );
-};
diff --git a/packages/clerk-js/src/ui/userProfile/username/Username.test.tsx b/packages/clerk-js/src/ui/userProfile/username/Username.test.tsx
deleted file mode 100644
index 4ddd736e3c0..00000000000
--- a/packages/clerk-js/src/ui/userProfile/username/Username.test.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { UserResource } from '@clerk/types';
-import * as React from 'react';
-
-import { Username } from './Username';
-
-const mockNavigate = jest.fn();
-
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- username: 'John',
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the Username', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/username/Username.tsx b/packages/clerk-js/src/ui/userProfile/username/Username.tsx
deleted file mode 100644
index 66567dc4e7e..00000000000
--- a/packages/clerk-js/src/ui/userProfile/username/Username.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import { EditableField } from 'ui/userProfile/EditableField';
-
-export function Username(): JSX.Element {
- return (
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/username/__snapshots__/Username.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/username/__snapshots__/Username.test.tsx.snap
deleted file mode 100644
index 798b15d0e5c..00000000000
--- a/packages/clerk-js/src/ui/userProfile/username/__snapshots__/Username.test.tsx.snap
+++ /dev/null
@@ -1,97 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the Username 1`] = `
-Array [
-
-
-
-
-
-
- Username
-
-
- Edit your username
-
-
-
,
- ,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/username/index.tsx b/packages/clerk-js/src/ui/userProfile/username/index.tsx
deleted file mode 100644
index bee78b190b6..00000000000
--- a/packages/clerk-js/src/ui/userProfile/username/index.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import React from 'react';
-import { Route } from 'ui/router';
-
-import { Username } from './Username';
-
-export { Username };
-
-export function UsernameRoutes(): JSX.Element {
- return (
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/util.test.tsx b/packages/clerk-js/src/ui/userProfile/util.test.tsx
deleted file mode 100644
index f3d305280a2..00000000000
--- a/packages/clerk-js/src/ui/userProfile/util.test.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import React from 'react';
-
-import { Connections, PrimaryTag } from './util';
-
-describe('Utility components for EmailAddresses', () => {
- it('renders the primary tag', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-
- it('renders email connections', () => {
- const linkedResources = [
- { id: '123', type: 'oauth_google' },
- { id: '456', type: 'oauth_facebook' },
- ];
- const connections = renderJSON( );
- expect(connections).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/util.tsx b/packages/clerk-js/src/ui/userProfile/util.tsx
deleted file mode 100644
index 2353d77a9fe..00000000000
--- a/packages/clerk-js/src/ui/userProfile/util.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { Tag } from '@clerk/shared/components/tag';
-import { titleize } from '@clerk/shared/utils';
-import { IdentificationLinkResource } from '@clerk/types';
-import React from 'react';
-
-type ConnectionsProps = {
- linkedResources: IdentificationLinkResource[];
-};
-
-/**
- * Linked email resources are of type "oauth_{provider}" currently.
- * TODO: Type EmailIdentificationLinkResource at types/resources
- */
-export const Connections = ({ linkedResources }: ConnectionsProps) => {
- return (
- <>
- {linkedResources.map(resource => (
-
- Connected to {titleize(resource.type.split('oauth_')[1])}
-
- ))}
- >
- );
-};
-
-export const PrimaryTag = () => (
-
- Primary
-
-);
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/AddNewWeb3Wallet.test.tsx b/packages/clerk-js/src/ui/userProfile/web3Wallets/AddNewWeb3Wallet.test.tsx
deleted file mode 100644
index e0e9414953a..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/AddNewWeb3Wallet.test.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { UserResource, Web3WalletResource } from '@clerk/types';
-import React from 'react';
-
-import { AddNewWeb3Wallet } from './AddNewWeb3Wallet';
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- params: { web3_wallet_id: 'test-id' },
- resolve: () => {
- return {
- toURL: {
- href: 'https://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- primaryWeb3WalletId: 'test-id',
- web3Wallets: [
- {
- id: 'test-id',
- web3Wallet: '0x0000000000000000000000000000000000000000',
- verification: { status: 'verified' },
- } as Web3WalletResource,
- ],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the AddNewWeb3Wallet', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/AddNewWeb3Wallet.tsx b/packages/clerk-js/src/ui/userProfile/web3Wallets/AddNewWeb3Wallet.tsx
deleted file mode 100644
index d473cdfc2a5..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/AddNewWeb3Wallet.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { ArrowRightIcon } from '@clerk/shared/assets/icons';
-import { List } from '@clerk/shared/components/list';
-import { Spinner } from '@clerk/shared/components/spinner';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { WEB3_PROVIDERS, Web3Provider } from '@clerk/types';
-import React, { useState } from 'react';
-import { getFieldError, handleError, svgUrl } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-import { generateSignatureWithMetamask, getMetamaskIdentifier } from 'utils/web3';
-
-export function AddNewWeb3Wallet(): JSX.Element {
- const user = useCoreUser();
- const { navigate } = useNavigate();
- const [error, setError] = useState();
- const [busyProvider, setBusyProvider] = useState(null);
-
- const handleClick = async (provider: Web3Provider) => {
- setError(undefined);
- setBusyProvider(provider);
-
- const identifier = await getMetamaskIdentifier();
-
- try {
- let web3Wallet = await user.createWeb3Wallet({ web3Wallet: identifier });
- web3Wallet = await web3Wallet.prepareVerification({ strategy: 'web3_metamask_signature' });
- const signature = await generateSignatureWithMetamask({
- identifier,
- nonce: web3Wallet.verification.nonce as string,
- });
- await web3Wallet.attemptVerification({ signature });
-
- navigate(`../${web3Wallet.id}`);
- } catch (err) {
- const fieldError = getFieldError(err);
- if (fieldError) {
- setError(fieldError.longMessage);
- } else {
- handleError(err, [], setError);
- }
-
- setBusyProvider(null);
- }
- };
-
- return (
- <>
-
-
- {error}
-
-
- {WEB3_PROVIDERS.map(p => (
- handleClick(p.provider)}
- detailIcon={busyProvider === p.provider ? : }
- >
-
-
- Connect {p.name} wallet
-
-
- ))}
-
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletDetail.test.tsx b/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletDetail.test.tsx
deleted file mode 100644
index 2d6280adb8d..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletDetail.test.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { EnvironmentResource, UserResource, UserSettingsResource, Web3WalletResource } from '@clerk/types';
-import React from 'react';
-import { PartialDeep } from 'type-fest';
-
-import { Web3WalletDetail } from './Web3WalletDetail';
-
-const mockNavigate = jest.fn();
-jest.mock('ui/hooks', () => ({
- useNavigate: () => {
- return {
- navigate: mockNavigate,
- };
- },
-}));
-
-jest.mock('ui/router/RouteContext', () => {
- return {
- useRouter: () => {
- return {
- params: { web3_wallet_id: 'test-id' },
- resolve: () => {
- return {
- toURL: {
- href: 'https://www.ssddd.com',
- },
- };
- },
- };
- },
- };
-});
-
-jest.mock('ui/contexts', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- primaryWeb3WalletId: 'test-id',
- web3Wallets: [
- {
- id: 'test-id',
- web3Wallet: '0x0000000000000000000000000000000000000000',
- verification: { status: 'verified' },
- } as Web3WalletResource,
- ],
- };
- },
- useEnvironment: jest.fn(
- () =>
- ({
- userSettings: {} as PartialDeep,
- } as PartialDeep),
- ),
- };
-});
-
-describe(' ', () => {
- it('renders Web3WalletDetail', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletDetail.tsx b/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletDetail.tsx
deleted file mode 100644
index ab142e26297..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletDetail.tsx
+++ /dev/null
@@ -1,142 +0,0 @@
-// @ts-ignore
-import { default as BinIcon } from '@clerk/shared/assets/icons/bin.svg';
-// @ts-ignore
-import { default as MailIcon } from '@clerk/shared/assets/icons/mail.svg';
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { VerificationStatusTag } from '@clerk/shared/components/tag';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { Toggle } from '@clerk/shared/components/toggle';
-import React from 'react';
-import { handleError } from 'ui/common';
-import { Alert } from 'ui/common/alert';
-import { useCoreUser } from 'ui/contexts';
-import { useNavigate } from 'ui/hooks';
-import { useRouter } from 'ui/router';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-import { EditableListFieldRemoveCard } from '../EditableListFieldRemoveCard';
-import { PrimaryTag } from '../util';
-
-export function Web3WalletDetail(): JSX.Element | null {
- const { navigate } = useNavigate();
- const user = useCoreUser();
- const { params } = useRouter();
- const [showRemovalPage, setShowRemovalPage] = React.useState(false);
- const [error, setError] = React.useState();
-
- const web3Wallet = user.web3Wallets.find(ea => ea.id === params.web3_wallet_id);
- const isPrimary = web3Wallet?.id === user.primaryWeb3WalletId;
-
- if (!web3Wallet) {
- return null;
- }
-
- const verificationStatus = web3Wallet.verification?.status || 'unverified';
- const isVerified = web3Wallet.verification?.status === 'verified';
-
- const handleRemove = () => {
- setShowRemovalPage(true);
- };
-
- const onWeb3WalletRemove = () => {
- return web3Wallet.destroy();
- };
-
- const makeIdentPrimary = async () => {
- await user.update({ primaryWeb3WalletId: web3Wallet.id }).catch(e => handleError(e, [], setError));
- };
-
- const removeWeb3WalletScreen = (
- {
- setShowRemovalPage(false);
- }}
- onRemove={onWeb3WalletRemove}
- onRemoved={() => {
- navigate('../');
- }}
- />
- );
-
- return (
- <>
-
- {showRemovalPage && removeWeb3WalletScreen}
- {!showRemovalPage && (
-
-
- {error}
-
-
-
-
-
-
- {web3Wallet.web3Wallet}
-
-
-
-
-
- {isVerified && (
-
-
-
- )}
-
-
-
- Unlink
-
-
- )}
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletList.test.tsx b/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletList.test.tsx
deleted file mode 100644
index 1edbf4e812a..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletList.test.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { renderJSON } from '@clerk/shared/testUtils';
-import { UserResource, Web3WalletResource } from '@clerk/types';
-import React from 'react';
-
-import { Web3WalletList } from './Web3WalletList';
-
-jest.mock('ui/router/RouteContext');
-
-jest.mock('ui/contexts/CoreUserContext', () => {
- return {
- useCoreUser: (): Partial => {
- return {
- primaryWeb3WalletId: 'test-id-1',
- web3Wallets: [
- {
- id: 'test-id-1',
- web3Wallet: '0x0000000000000000000000000000000000000000',
- verification: { status: 'verified' },
- } as Web3WalletResource,
- {
- id: 'test-id-2',
- web3Wallet: '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
- verification: { status: 'verified' },
- } as Web3WalletResource,
- ],
- };
- },
- };
-});
-
-describe(' ', () => {
- it('renders the list', () => {
- const tree = renderJSON( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletList.tsx b/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletList.tsx
deleted file mode 100644
index a73086e121a..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/Web3WalletList.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { Button } from '@clerk/shared/components/button';
-import { List } from '@clerk/shared/components/list';
-import { VerificationStatusTag } from '@clerk/shared/components/tag';
-import { TitledCard } from '@clerk/shared/components/titledCard';
-import { Web3WalletResource } from '@clerk/types';
-import React from 'react';
-import { useCoreUser } from 'ui/contexts';
-import { useRouter } from 'ui/router';
-import { PageHeading } from 'ui/userProfile/pageHeading';
-
-import { PrimaryTag } from '../util';
-
-type Web3WalletListItemProps = {
- web3Wallet: Web3WalletResource;
- handleClick: () => any | undefined;
- isPrimary: boolean;
-};
-
-function Web3WalletListItem({ web3Wallet, handleClick, isPrimary }: Web3WalletListItemProps): JSX.Element {
- const status = web3Wallet.verification.status || 'unverified';
-
- return (
-
-
- {web3Wallet.web3Wallet}{' '}
-
-
-
- );
-}
-
-export function Web3WalletList(): JSX.Element {
- const user = useCoreUser();
- const router = useRouter();
-
- const web3WalletItems = user.web3Wallets.map(web3Wallet => (
- router.navigate(web3Wallet.id)}
- isPrimary={user.primaryWeb3WalletId === web3Wallet.id}
- />
- ));
-
- return (
- <>
-
-
- {user.web3Wallets.length > 0 && {web3WalletItems}
}
- {user.web3Wallets.length === 0 && (
- <>
- No web3 wallets to display
- {/*Since only Metamask wallet is supported for now, we don't allow the user to add another*/}
- {/*Web3 wallet address. When we add support for more wallets, this logic should be refactored*/}
- router.navigate('add')}
- className='cl-add-resource-button'
- type='button'
- flavor='text'
- buttonColor='primary'
- hoverable
- >
- Add web3 wallet
-
- >
- )}
-
- >
- );
-}
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/AddNewWeb3Wallet.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/AddNewWeb3Wallet.test.tsx.snap
deleted file mode 100644
index f2b35dcf196..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/AddNewWeb3Wallet.test.tsx.snap
+++ /dev/null
@@ -1,86 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the AddNewWeb3Wallet 1`] = `
-Array [
- ,
-
-
-
- Add web3 wallet
-
-
- Connect your web3 wallet
-
-
-
-
-
-
-
-
- Connect
- MetaMask
- wallet
-
-
-
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/Web3WalletDetail.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/Web3WalletDetail.test.tsx.snap
deleted file mode 100644
index 6adcb13388c..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/Web3WalletDetail.test.tsx.snap
+++ /dev/null
@@ -1,145 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders Web3WalletDetail 1`] = `
-Array [
-
-
-
-
-
-
- Web3 wallet
-
-
- Manage this Web3 wallet
-
-
-
,
-
-
-
-
-
-
-
- 0x0000000000000000000000000000000000000000
-
-
- Primary
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Primary web3 wallet
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Unlink
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/Web3WalletList.test.tsx.snap b/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/Web3WalletList.test.tsx.snap
deleted file mode 100644
index 39944412e13..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/__snapshots__/Web3WalletList.test.tsx.snap
+++ /dev/null
@@ -1,116 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders the list 1`] = `
-Array [
-
-
-
-
-
-
- Web3 wallets
-
-
- Manage web3 wallets associated with your account
-
-
-
,
-
-
-
-
-
-
- 0x0000000000000000000000000000000000000000
-
-
-
- Primary
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-
-
-
- Verified
-
-
-
-
-
-
-
-
-
-
-
,
-]
-`;
diff --git a/packages/clerk-js/src/ui/userProfile/web3Wallets/index.tsx b/packages/clerk-js/src/ui/userProfile/web3Wallets/index.tsx
deleted file mode 100644
index b86a655a5ad..00000000000
--- a/packages/clerk-js/src/ui/userProfile/web3Wallets/index.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import React from 'react';
-import { Route } from 'ui/router';
-
-import { AddNewWeb3Wallet } from './AddNewWeb3Wallet';
-import { Web3WalletDetail } from './Web3WalletDetail';
-import { Web3WalletList } from './Web3WalletList';
-
-export { AddNewWeb3Wallet, Web3WalletDetail, Web3WalletList };
-
-export function Web3WalletsRoutes(): JSX.Element {
- return (
-
-
-
-
-
-
-
-
-
-
-
- );
-}
diff --git a/packages/clerk-js/src/v4/utils/colorPredicates.ts b/packages/clerk-js/src/ui/utils/colorPredicates.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/colorPredicates.ts
rename to packages/clerk-js/src/ui/utils/colorPredicates.ts
diff --git a/packages/clerk-js/src/v4/utils/colorTransformations.test.ts b/packages/clerk-js/src/ui/utils/colorTransformations.test.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/colorTransformations.test.ts
rename to packages/clerk-js/src/ui/utils/colorTransformations.test.ts
diff --git a/packages/clerk-js/src/v4/utils/colorTransformations.ts b/packages/clerk-js/src/ui/utils/colorTransformations.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/colorTransformations.ts
rename to packages/clerk-js/src/ui/utils/colorTransformations.ts
diff --git a/packages/clerk-js/src/v4/utils/colors.test.ts b/packages/clerk-js/src/ui/utils/colors.test.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/colors.test.ts
rename to packages/clerk-js/src/ui/utils/colors.test.ts
diff --git a/packages/clerk-js/src/v4/utils/colors.ts b/packages/clerk-js/src/ui/utils/colors.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/colors.ts
rename to packages/clerk-js/src/ui/utils/colors.ts
diff --git a/packages/clerk-js/src/v4/utils/containsAllOf.ts b/packages/clerk-js/src/ui/utils/containsAllOf.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/containsAllOf.ts
rename to packages/clerk-js/src/ui/utils/containsAllOf.ts
diff --git a/packages/clerk-js/src/v4/utils/createContextAndHook.ts b/packages/clerk-js/src/ui/utils/createContextAndHook.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/createContextAndHook.ts
rename to packages/clerk-js/src/ui/utils/createContextAndHook.ts
diff --git a/packages/clerk-js/src/v4/utils/createInfiniteAccessProxy.ts b/packages/clerk-js/src/ui/utils/createInfiniteAccessProxy.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/createInfiniteAccessProxy.ts
rename to packages/clerk-js/src/ui/utils/createInfiniteAccessProxy.ts
diff --git a/packages/clerk-js/src/v4/utils/errorHandler.ts b/packages/clerk-js/src/ui/utils/errorHandler.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/errorHandler.ts
rename to packages/clerk-js/src/ui/utils/errorHandler.ts
diff --git a/packages/clerk-js/src/v4/utils/factorSorting.ts b/packages/clerk-js/src/ui/utils/factorSorting.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/factorSorting.ts
rename to packages/clerk-js/src/ui/utils/factorSorting.ts
diff --git a/packages/clerk-js/src/v4/utils/fastDeepMerge.test.ts b/packages/clerk-js/src/ui/utils/fastDeepMerge.test.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/fastDeepMerge.test.ts
rename to packages/clerk-js/src/ui/utils/fastDeepMerge.test.ts
diff --git a/packages/clerk-js/src/v4/utils/fastDeepMerge.ts b/packages/clerk-js/src/ui/utils/fastDeepMerge.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/fastDeepMerge.ts
rename to packages/clerk-js/src/ui/utils/fastDeepMerge.ts
diff --git a/packages/clerk-js/src/v4/utils/formatSafeIdentifier.ts b/packages/clerk-js/src/ui/utils/formatSafeIdentifier.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/formatSafeIdentifier.ts
rename to packages/clerk-js/src/ui/utils/formatSafeIdentifier.ts
diff --git a/packages/clerk-js/src/ui/utils/fromEntries.ts b/packages/clerk-js/src/ui/utils/fromEntries.ts
new file mode 100644
index 00000000000..0de89b5b2b0
--- /dev/null
+++ b/packages/clerk-js/src/ui/utils/fromEntries.ts
@@ -0,0 +1,6 @@
+export const fromEntries = (iterable: Iterable) => {
+ return [...iterable].reduce((obj, [key, val]) => {
+ obj[key] = val;
+ return obj;
+ }, {});
+};
diff --git a/packages/clerk-js/src/v4/utils/getFullName.ts b/packages/clerk-js/src/ui/utils/getFullName.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/getFullName.ts
rename to packages/clerk-js/src/ui/utils/getFullName.ts
diff --git a/packages/clerk-js/src/v4/utils/getIdentifier.ts b/packages/clerk-js/src/ui/utils/getIdentifier.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/getIdentifier.ts
rename to packages/clerk-js/src/ui/utils/getIdentifier.ts
diff --git a/packages/clerk-js/src/v4/utils/index.ts b/packages/clerk-js/src/ui/utils/index.ts
similarity index 94%
rename from packages/clerk-js/src/v4/utils/index.ts
rename to packages/clerk-js/src/ui/utils/index.ts
index 20bce7d0916..cee86ba8763 100644
--- a/packages/clerk-js/src/v4/utils/index.ts
+++ b/packages/clerk-js/src/ui/utils/index.ts
@@ -15,3 +15,4 @@ export * from './phoneUtils';
export * from './formatSafeIdentifier';
export * from './removeUndefinedProps';
export * from './getIdentifier';
+export * from './fromEntries';
diff --git a/packages/clerk-js/src/v4/utils/isMobileDevice.ts b/packages/clerk-js/src/ui/utils/isMobileDevice.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/isMobileDevice.ts
rename to packages/clerk-js/src/ui/utils/isMobileDevice.ts
diff --git a/packages/clerk-js/src/v4/utils/phoneUtils.test.ts b/packages/clerk-js/src/ui/utils/phoneUtils.test.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/phoneUtils.test.ts
rename to packages/clerk-js/src/ui/utils/phoneUtils.test.ts
diff --git a/packages/clerk-js/src/v4/utils/phoneUtils.ts b/packages/clerk-js/src/ui/utils/phoneUtils.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/phoneUtils.ts
rename to packages/clerk-js/src/ui/utils/phoneUtils.ts
diff --git a/packages/clerk-js/src/v4/utils/removeUndefinedProps.ts b/packages/clerk-js/src/ui/utils/removeUndefinedProps.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/removeUndefinedProps.ts
rename to packages/clerk-js/src/ui/utils/removeUndefinedProps.ts
diff --git a/packages/clerk-js/src/v4/utils/sleep.ts b/packages/clerk-js/src/ui/utils/sleep.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/sleep.ts
rename to packages/clerk-js/src/ui/utils/sleep.ts
diff --git a/packages/clerk-js/src/v4/utils/useDeepEqualMemo.ts b/packages/clerk-js/src/ui/utils/useDeepEqualMemo.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/useDeepEqualMemo.ts
rename to packages/clerk-js/src/ui/utils/useDeepEqualMemo.ts
diff --git a/packages/clerk-js/src/v4/utils/useFormControl.ts b/packages/clerk-js/src/ui/utils/useFormControl.ts
similarity index 100%
rename from packages/clerk-js/src/v4/utils/useFormControl.ts
rename to packages/clerk-js/src/ui/utils/useFormControl.ts
diff --git a/packages/clerk-js/src/utils/ignoreEventValue.test.ts b/packages/clerk-js/src/utils/ignoreEventValue.test.ts
index c795467a7c6..c426d370aaa 100644
--- a/packages/clerk-js/src/utils/ignoreEventValue.test.ts
+++ b/packages/clerk-js/src/utils/ignoreEventValue.test.ts
@@ -1,5 +1,6 @@
import { noop } from '@clerk/shared/testUtils';
-import { ignoreEventValue } from 'utils/ignoreEventValue';
+
+import { ignoreEventValue } from './ignoreEventValue';
describe('ignoreNonEventValue', () => {
it('allows non event values', () => {
diff --git a/packages/clerk-js/src/utils/memoizeStateListenerCallback.test.ts b/packages/clerk-js/src/utils/memoizeStateListenerCallback.test.ts
index 502a376b0ef..81ff6880e0e 100644
--- a/packages/clerk-js/src/utils/memoizeStateListenerCallback.test.ts
+++ b/packages/clerk-js/src/utils/memoizeStateListenerCallback.test.ts
@@ -6,9 +6,7 @@ describe('memoizeStateListenerCallback', () => {
it('runs', () => {});
});
-// import { User } from 'core/resources';
// import { Resources, UserJSON } from '@clerk/types';
-// import { memoizeListenerCallback } from 'utils/memoizeStateListenerCallback';
//
// const frontEndApi = '';
// const path = '';
diff --git a/packages/clerk-js/src/v4/SignIn/index.ts b/packages/clerk-js/src/v4/SignIn/index.ts
deleted file mode 100644
index a573a358ee9..00000000000
--- a/packages/clerk-js/src/v4/SignIn/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './SignIn';
diff --git a/packages/clerk-js/src/v4/SignUp/index.ts b/packages/clerk-js/src/v4/SignUp/index.ts
deleted file mode 100644
index 6169154a2c9..00000000000
--- a/packages/clerk-js/src/v4/SignUp/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './SignUp';
diff --git a/packages/clerk-js/src/v4/UserButton/index.ts b/packages/clerk-js/src/v4/UserButton/index.ts
deleted file mode 100644
index ab6156ab876..00000000000
--- a/packages/clerk-js/src/v4/UserButton/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './UserButton';
diff --git a/packages/clerk-js/src/v4/UserProfile/index.ts b/packages/clerk-js/src/v4/UserProfile/index.ts
deleted file mode 100644
index 884472841f1..00000000000
--- a/packages/clerk-js/src/v4/UserProfile/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './UserProfile';
diff --git a/packages/clerk-js/src/v4/common/SSOCallback.tsx b/packages/clerk-js/src/v4/common/SSOCallback.tsx
deleted file mode 100644
index de50cc56724..00000000000
--- a/packages/clerk-js/src/v4/common/SSOCallback.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { HandleOAuthCallbackParams } from '@clerk/types/src';
-import React from 'react';
-
-import { useCoreClerk } from '../../ui/contexts';
-import { useNavigate } from '../../ui/hooks';
-import { Flow } from '../customizables';
-import { LoadingCard } from '../elements';
-
-export const SSOCallback = (props: HandleOAuthCallbackParams) => {
- const { handleRedirectCallback } = useCoreClerk();
- const { navigate } = useNavigate();
-
- React.useEffect(() => {
- handleRedirectCallback({ ...props }, navigate).catch(() => {
- // This error is caused when the host app is using React18
- // and strictMode is enabled. This useEffects runs twice because
- // the clerk-react ui components mounts, unmounts and mounts again
- // so the clerk-js component loses its state because of the custom
- // unmount callback we're using.
- // This needs to be solved by tweaking the logic in uiComponents.tsx
- // or by making handleRedirectCallback idempotent
- });
- }, []);
-
- return (
-
-
-
- );
-};
diff --git a/packages/clerk-js/src/v4/common/index.ts b/packages/clerk-js/src/v4/common/index.ts
deleted file mode 100644
index 2f6fcefe0a6..00000000000
--- a/packages/clerk-js/src/v4/common/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './SSOCallback';
-export * from './EmailLinkVerify';
-export * from './EmailLinkStatusCard';
-export * from './Wizard';
diff --git a/packages/clerk-js/src/v4/hooks/index.ts b/packages/clerk-js/src/v4/hooks/index.ts
deleted file mode 100644
index 8d0ed8e7337..00000000000
--- a/packages/clerk-js/src/v4/hooks/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export * from './useClipboard';
-export * from './useEnabledThirdPartyProviders';
-export * from './useLoadingStatus';
-export * from './useSafeLayoutEffect';
-export * from './usePopover';
-export * from './useLocalStorage';
-export * from './useSearchInput';
-export * from './useSafeState';
-export * from './useScrollLock';
diff --git a/packages/clerk-js/tsconfig.json b/packages/clerk-js/tsconfig.json
index 76132122784..17484aa64f1 100644
--- a/packages/clerk-js/tsconfig.json
+++ b/packages/clerk-js/tsconfig.json
@@ -19,13 +19,7 @@
"useUnknownInCatchVariables": false,
"declaration": false,
"jsx": "react-jsx",
- "jsxImportSource": "@emotion/react",
- "paths": {
- "ui/*": ["ui/*"],
- "core/*": ["core/*"],
- "utils/*": ["utils/*"],
- "types/*": ["types/*"]
- }
+ "jsxImportSource": "@emotion/react"
},
"include": [
"src/index.ts",
diff --git a/packages/clerk-js/tsconfig.stable.json b/packages/clerk-js/tsconfig.stable.json
index 7ad4a3f7732..f4815ec9354 100644
--- a/packages/clerk-js/tsconfig.stable.json
+++ b/packages/clerk-js/tsconfig.stable.json
@@ -14,18 +14,12 @@
"noImplicitReturns": true,
"noUnusedLocals": false,
"noUnusedParameters": true,
- "paths": {
- "ui/*": ["ui/*"],
- "core/*": ["core/*"],
- "utils/*": ["utils/*"],
- "types/*": ["types/*"]
- },
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"target": "ES2019",
"useUnknownInCatchVariables": false
},
- "exclude": ["node_modules", "src/v4", "src/index.browser.v4.ts"],
+ "exclude": ["node_modules"],
"include": ["src/**/*"]
}
diff --git a/packages/clerk-js/tsconfig.v4.json b/packages/clerk-js/tsconfig.v4.json
index 6b71978c205..3459c99a6c3 100644
--- a/packages/clerk-js/tsconfig.v4.json
+++ b/packages/clerk-js/tsconfig.v4.json
@@ -5,6 +5,6 @@
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react"
},
- "exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx", "**/*.v3.tsx", "**/*.v3.ts"],
+ "exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"],
"include": ["src/**/*"]
}
diff --git a/packages/edge/CHANGELOG.md b/packages/edge/CHANGELOG.md
index ecbfff6f05d..2f24cabbbea 100644
--- a/packages/edge/CHANGELOG.md
+++ b/packages/edge/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [1.7.6](https://github.com/clerkinc/javascript/compare/@clerk/edge@1.7.5...@clerk/edge@1.7.6) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/edge
+
### [1.7.5](https://github.com/clerkinc/javascript/compare/@clerk/edge@1.7.5-staging.0...@clerk/edge@1.7.5) (2022-08-09)
**Note:** Version bump only for package @clerk/edge
diff --git a/packages/edge/package.json b/packages/edge/package.json
index f21583fc842..b4d4a451087 100644
--- a/packages/edge/package.json
+++ b/packages/edge/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/edge",
- "version": "1.7.5",
+ "version": "1.7.6",
"license": "MIT",
"description": "Clerk SDK for serverless and edge environments",
"keywords": [
@@ -36,8 +36,8 @@
"build": "node ./scripts/info.cjs && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && ./moduleTypeFix"
},
"dependencies": {
- "@clerk/backend-core": "^2.0.2",
- "@clerk/types": "^3.1.0",
+ "@clerk/backend-core": "^2.0.3",
+ "@clerk/types": "^3.1.1",
"@peculiar/webcrypto": "^1.2.3",
"next": "^12.2.0"
},
diff --git a/packages/edge/src/info.ts b/packages/edge/src/info.ts
index 71a85cf6f8d..4423782f999 100644
--- a/packages/edge/src/info.ts
+++ b/packages/edge/src/info.ts
@@ -1,3 +1,3 @@
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
-export const LIB_VERSION = '1.7.5';
+export const LIB_VERSION = '1.7.6';
export const LIB_NAME = '@clerk/edge';
diff --git a/packages/expo/CHANGELOG.md b/packages/expo/CHANGELOG.md
index 5037ac04fec..4b75d41e70d 100644
--- a/packages/expo/CHANGELOG.md
+++ b/packages/expo/CHANGELOG.md
@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [0.9.43](https://github.com/clerkinc/javascript/compare/@clerk/clerk-expo@0.9.42...@clerk/clerk-expo@0.9.43) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/clerk-expo
+
+### [0.9.42](https://github.com/clerkinc/javascript/compare/@clerk/clerk-expo@0.9.42-staging.1...@clerk/clerk-expo@0.9.42) (2022-08-11)
+
+**Note:** Version bump only for package @clerk/clerk-expo
+
+### [0.9.41](https://github.com/clerkinc/javascript/compare/@clerk/clerk-expo@0.9.41-staging.0...@clerk/clerk-expo@0.9.41) (2022-08-10)
+
+**Note:** Version bump only for package @clerk/clerk-expo
+
### [0.9.40](https://github.com/clerkinc/javascript/compare/@clerk/clerk-expo@0.9.40-staging.0...@clerk/clerk-expo@0.9.40) (2022-08-09)
**Note:** Version bump only for package @clerk/clerk-expo
diff --git a/packages/expo/package.json b/packages/expo/package.json
index ff57032d2f6..88b92ca620c 100644
--- a/packages/expo/package.json
+++ b/packages/expo/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/clerk-expo",
- "version": "0.9.40",
+ "version": "0.9.43",
"license": "MIT",
"description": "Clerk.dev React Native/Expo library",
"keywords": [
@@ -26,12 +26,13 @@
"dev": "tsc -p tsconfig.build.json --watch"
},
"dependencies": {
- "@clerk/clerk-js": "^4.0.2",
- "@clerk/clerk-react": "^4.0.2",
- "base-64": "^1.0.0"
+ "@clerk/clerk-js": "^4.1.1",
+ "@clerk/clerk-react": "^4.0.3",
+ "base-64": "^1.0.0",
+ "react-native-url-polyfill": "^1.3.0"
},
"devDependencies": {
- "@clerk/types": "^3.1.0",
+ "@clerk/types": "^3.1.1",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.9",
"@types/react": "^17.0.39",
diff --git a/packages/expo/src/polyfills/index.ts b/packages/expo/src/polyfills/index.ts
index 88201cf14a9..0b23574ca83 100644
--- a/packages/expo/src/polyfills/index.ts
+++ b/packages/expo/src/polyfills/index.ts
@@ -1 +1,2 @@
+import 'react-native-url-polyfill/auto';
import './base64Polyfill';
diff --git a/packages/nextjs/CHANGELOG.md b/packages/nextjs/CHANGELOG.md
index da024eeaced..ef93c03c986 100644
--- a/packages/nextjs/CHANGELOG.md
+++ b/packages/nextjs/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [4.0.3](https://github.com/clerkinc/javascript/compare/@clerk/nextjs@4.0.3-staging.0...@clerk/nextjs@4.0.3) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/nextjs
+
### [4.0.2](https://github.com/clerkinc/javascript/compare/@clerk/nextjs@4.0.2-staging.0...@clerk/nextjs@4.0.2) (2022-08-09)
**Note:** Version bump only for package @clerk/nextjs
diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json
index 04f20b84b1b..abc2a3e15cb 100644
--- a/packages/nextjs/package.json
+++ b/packages/nextjs/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/nextjs",
- "version": "4.0.2",
+ "version": "4.0.3",
"license": "MIT",
"description": "Clerk.dev SDK for NextJS",
"keywords": [
@@ -32,10 +32,10 @@
"dev": "tsc -p tsconfig.build.json --watch"
},
"dependencies": {
- "@clerk/clerk-react": "^4.0.2",
- "@clerk/clerk-sdk-node": "^4.0.2",
- "@clerk/edge": "^1.7.5",
- "@clerk/types": "^3.1.0",
+ "@clerk/clerk-react": "^4.0.3",
+ "@clerk/clerk-sdk-node": "^4.0.3",
+ "@clerk/edge": "^1.7.6",
+ "@clerk/types": "^3.1.1",
"tslib": "^2.3.1"
},
"devDependencies": {
diff --git a/packages/nextjs/src/middleware/utils/sanitizeAuthData.ts b/packages/nextjs/src/middleware/utils/sanitizeAuthData.ts
index 97450caf620..40703568536 100644
--- a/packages/nextjs/src/middleware/utils/sanitizeAuthData.ts
+++ b/packages/nextjs/src/middleware/utils/sanitizeAuthData.ts
@@ -2,7 +2,7 @@ import { AuthData } from '../types';
/**
*
- * Removes sensitive data from User and Session
+ * Removes sensitive data from User and Organization
* This allows for sensitive fields like `user.privateMetadata` to be available
* inside the `withServerSideAuth` callback, while ensuring that these fields
* will not get serialized into the client-accessible __NEXT_DATA__ script
@@ -15,5 +15,12 @@ export function sanitizeAuthData(authData: AuthData): any {
// @ts-expect-error;
delete user['privateMetadata'];
}
- return { ...authData, user };
+
+ const organization = authData.organization ? { ...authData.organization } : authData.organization;
+ if (organization) {
+ // @ts-expect-error;
+ delete organization['privateMetadata'];
+ }
+
+ return { ...authData, user, organization };
}
diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md
index 6a82fc56a7a..688df25de76 100644
--- a/packages/react/CHANGELOG.md
+++ b/packages/react/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [4.0.3](https://github.com/clerkinc/javascript/compare/@clerk/clerk-react@4.0.2...@clerk/clerk-react@4.0.3) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/clerk-react
+
### [4.0.2](https://github.com/clerkinc/javascript/compare/@clerk/clerk-react@4.0.2-staging.0...@clerk/clerk-react@4.0.2) (2022-08-09)
**Note:** Version bump only for package @clerk/clerk-react
diff --git a/packages/react/package.json b/packages/react/package.json
index 2ea2ed1fee6..250c636e72a 100644
--- a/packages/react/package.json
+++ b/packages/react/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/clerk-react",
- "version": "4.0.2",
+ "version": "4.0.3",
"license": "MIT",
"description": "Clerk.dev React library",
"keywords": [
@@ -28,7 +28,7 @@
"test": "jest"
},
"dependencies": {
- "@clerk/types": "^3.1.0",
+ "@clerk/types": "^3.1.1",
"swr": "^1.3.0",
"tslib": "^2.3.1"
},
diff --git a/packages/react/src/info.ts b/packages/react/src/info.ts
index 7ecd23f52c5..a4e3a6cd5b9 100644
--- a/packages/react/src/info.ts
+++ b/packages/react/src/info.ts
@@ -1,3 +1,3 @@
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
-export const LIB_VERSION = '4.0.2';
+export const LIB_VERSION = '4.0.3';
export const LIB_NAME = '@clerk/clerk-react';
diff --git a/packages/remix/CHANGELOG.md b/packages/remix/CHANGELOG.md
index 4a5f76d2d26..2bead88c47d 100644
--- a/packages/remix/CHANGELOG.md
+++ b/packages/remix/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [1.0.3](https://github.com/clerkinc/javascript/compare/@clerk/remix@1.0.2...@clerk/remix@1.0.3) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/remix
+
### [1.0.2](https://github.com/clerkinc/javascript/compare/@clerk/remix@1.0.2-staging.0...@clerk/remix@1.0.2) (2022-08-09)
**Note:** Version bump only for package @clerk/remix
diff --git a/packages/remix/package.json b/packages/remix/package.json
index c347d020fba..e7af3df06f2 100644
--- a/packages/remix/package.json
+++ b/packages/remix/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/remix",
- "version": "1.0.2",
+ "version": "1.0.3",
"license": "MIT",
"description": "Clerk.dev SDK for Remix",
"keywords": [
@@ -32,9 +32,9 @@
"dev": "tsc -p tsconfig.build.json --watch"
},
"dependencies": {
- "@clerk/clerk-react": "^4.0.2",
- "@clerk/clerk-sdk-node": "^4.0.2",
- "@clerk/types": "^3.1.0",
+ "@clerk/clerk-react": "^4.0.3",
+ "@clerk/clerk-sdk-node": "^4.0.3",
+ "@clerk/types": "^3.1.1",
"cookie": "^0.5.0",
"tslib": "^2.3.1"
},
diff --git a/packages/sdk-node/CHANGELOG.md b/packages/sdk-node/CHANGELOG.md
index 4f7765c2d2d..5736ded9412 100644
--- a/packages/sdk-node/CHANGELOG.md
+++ b/packages/sdk-node/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [4.0.3](https://github.com/clerkinc/javascript/compare/@clerk/clerk-sdk-node@4.0.2...@clerk/clerk-sdk-node@4.0.3) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/clerk-sdk-node
+
### [4.0.2](https://github.com/clerkinc/javascript/compare/@clerk/clerk-sdk-node@4.0.2-staging.0...@clerk/clerk-sdk-node@4.0.2) (2022-08-09)
**Note:** Version bump only for package @clerk/clerk-sdk-node
diff --git a/packages/sdk-node/package.json b/packages/sdk-node/package.json
index 96d47ae553d..37b269c0ce0 100644
--- a/packages/sdk-node/package.json
+++ b/packages/sdk-node/package.json
@@ -1,5 +1,5 @@
{
- "version": "4.0.2",
+ "version": "4.0.3",
"license": "MIT",
"main": "dist/index.js",
"module": "esm/index.js",
@@ -48,8 +48,8 @@
"typescript": "^4.6.4"
},
"dependencies": {
- "@clerk/backend-core": "^2.0.2",
- "@clerk/types": "^3.1.0",
+ "@clerk/backend-core": "^2.0.3",
+ "@clerk/types": "^3.1.1",
"@peculiar/webcrypto": "^1.2.3",
"camelcase-keys": "^6.2.2",
"cookies": "^0.8.0",
diff --git a/packages/sdk-node/src/info.ts b/packages/sdk-node/src/info.ts
index 9b00eff6759..9578d441eb3 100644
--- a/packages/sdk-node/src/info.ts
+++ b/packages/sdk-node/src/info.ts
@@ -1,3 +1,3 @@
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
-export const LIB_VERSION = '4.0.2';
+export const LIB_VERSION = '4.0.3';
export const LIB_NAME = '@clerk/clerk-sdk-node';
diff --git a/packages/shared/CHANGELOG.md b/packages/shared/CHANGELOG.md
index e6493e35cab..4cf7c5d8c2a 100644
--- a/packages/shared/CHANGELOG.md
+++ b/packages/shared/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [0.3.11](https://github.com/clerkinc/clerk_docker/compare/@clerk/shared@0.3.10...@clerk/shared@0.3.11) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/shared
+
### [0.3.10](https://github.com/clerkinc/clerk_docker/compare/@clerk/shared@0.3.10-staging.0...@clerk/shared@0.3.10) (2022-08-09)
**Note:** Version bump only for package @clerk/shared
diff --git a/packages/shared/package.json b/packages/shared/package.json
index 01129b6f8ac..01173e101d1 100644
--- a/packages/shared/package.json
+++ b/packages/shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/shared",
- "version": "0.3.10",
+ "version": "0.3.11",
"private": true,
"main": "index.js",
"module": "index.js",
@@ -26,7 +26,7 @@
"@babel/core": "^7.13.14",
"@babel/preset-env": "^7.13.12",
"@babel/preset-react": "^7.13.13",
- "@clerk/types": "^3.1.0",
+ "@clerk/types": "^3.1.1",
"@popperjs/core": "^2.5.4",
"@sentry/browser": "^6.3.0",
"@svgr/webpack": "^6.2.1",
diff --git a/packages/themes/CHANGELOG.md b/packages/themes/CHANGELOG.md
index 4f52e353a60..7a744ca61f4 100644
--- a/packages/themes/CHANGELOG.md
+++ b/packages/themes/CHANGELOG.md
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [1.2.1](https://github.com/clerkinc/javascript/compare/@clerk/themes@1.2.0...@clerk/themes@1.2.1) (2022-08-16)
+
+**Note:** Version bump only for package @clerk/themes
+
+## [1.2.0](https://github.com/clerkinc/javascript/compare/@clerk/themes@1.2.0-staging.0...@clerk/themes@1.2.0) (2022-08-11)
+
+**Note:** Version bump only for package @clerk/themes
+
## [1.1.0](https://github.com/clerkinc/javascript/compare/@clerk/themes@1.1.0-staging.0...@clerk/themes@1.1.0) (2022-08-09)
**Note:** Version bump only for package @clerk/themes
diff --git a/packages/themes/package.json b/packages/themes/package.json
index 848c5e932f6..6ba1216f1b5 100644
--- a/packages/themes/package.json
+++ b/packages/themes/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/themes",
- "version": "1.1.0",
+ "version": "1.2.1",
"license": "MIT",
"description": "Themes for the Clerk auth components",
"keywords": [
@@ -26,7 +26,7 @@
"dev": "tsc -p tsconfig.build.json --watch"
},
"devDependencies": {
- "@clerk/types": "^3.1.0",
+ "@clerk/types": "^3.1.1",
"typescript": "^4.6.4"
},
"peerDependencies": {
diff --git a/packages/themes/src/createTheme.ts b/packages/themes/src/createTheme.ts
index e2d311d308d..2d7641e1980 100644
--- a/packages/themes/src/createTheme.ts
+++ b/packages/themes/src/createTheme.ts
@@ -1,8 +1,9 @@
// Temp way to import the type. We will clean this up when we extract
// theming into its own package
-import type { InternalTheme } from '@clerk/clerk-js/src/v4/foundations';
import type { Appearance, BaseTheme, Elements, Theme } from '@clerk/types';
+import type { InternalTheme } from '../../clerk-js/src/ui/foundations';
+
type CreateClerkThemeParams = Theme & {
/**
* {@link Theme.elements}
diff --git a/packages/themes/src/themes/dark.ts b/packages/themes/src/themes/dark.ts
index eb539fab739..811d1322437 100644
--- a/packages/themes/src/themes/dark.ts
+++ b/packages/themes/src/themes/dark.ts
@@ -10,8 +10,8 @@ export const dark = unstable_createTheme({
},
elements: () => {
return {
- socialButtonsLogo__apple: { filter: 'invert(1)' },
- socialButtonsLogo__github: { filter: 'invert(1)' },
+ providerIcon__apple: { filter: 'invert(1)' },
+ providerIcon__github: { filter: 'invert(1)' },
activeDeviceIcon: {
'--cl-chassis-bottom': '#d2d2d2',
'--cl-chassis-back': '#e6e6e6',
diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md
index 67ae4185267..d3c45c9af7e 100644
--- a/packages/types/CHANGELOG.md
+++ b/packages/types/CHANGELOG.md
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+### [3.1.1](https://github.com/clerkinc/javascript/compare/@clerk/types@3.1.0...@clerk/types@3.1.1) (2022-08-16)
+
+### Bug Fixes
+
+- **types:** Deprecate orgs session token claim, add org_slug for active organization ([4175040](https://github.com/clerkinc/javascript/commit/4175040ca2257265cc0b8c12389056933765040b))
+
## [3.1.0](https://github.com/clerkinc/javascript/compare/@clerk/types@3.1.0-staging.0...@clerk/types@3.1.0) (2022-08-09)
### Bug Fixes
diff --git a/packages/types/package.json b/packages/types/package.json
index e87e7e58875..74032ed7507 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerk/types",
- "version": "3.1.0",
+ "version": "3.1.1",
"license": "MIT",
"description": "Typings for Clerk libraries.",
"keywords": [
diff --git a/packages/types/src/jwt.ts b/packages/types/src/jwt.ts
index 84de5407174..176c42842b9 100644
--- a/packages/types/src/jwt.ts
+++ b/packages/types/src/jwt.ts
@@ -65,7 +65,7 @@ export interface ClerkJWTClaims {
azp?: string;
/**
- *
+ * @deprecated - Add orgs to your session token using the "user.organizations" shortcode in JWT Templates instead
*/
orgs?: Record;
@@ -74,6 +74,11 @@ export interface ClerkJWTClaims {
*/
org_id?: string;
+ /**
+ * Active organization slug.
+ */
+ org_slug?: string;
+
/**
* Active organization role
*/