@oxy.so/services 11.4.0 → 11.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/lib/commonjs/index.js +0 -28
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/boot/runProviderColdBoot.js +47 -3
  4. package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
  5. package/lib/commonjs/ui/components/organizations/OrganizationClaimReview.js +2 -2
  6. package/lib/commonjs/ui/components/organizations/OrganizationClaimReview.js.map +1 -1
  7. package/lib/commonjs/ui/components/organizations/OrganizationDirectorySearch.js +5 -5
  8. package/lib/commonjs/ui/components/organizations/OrganizationDirectorySearch.js.map +1 -1
  9. package/lib/commonjs/ui/components/organizations/OrganizationSettings.js +4 -4
  10. package/lib/commonjs/ui/components/organizations/OrganizationSettings.js.map +1 -1
  11. package/lib/commonjs/ui/components/organizations/OrganizationTypePicker.js +2 -2
  12. package/lib/commonjs/ui/components/organizations/OrganizationTypePicker.js.map +1 -1
  13. package/lib/commonjs/ui/components/signIn/OxyAuthenticatorPanel.js +3 -3
  14. package/lib/commonjs/ui/components/signIn/OxyAuthenticatorPanel.js.map +1 -1
  15. package/lib/commonjs/ui/components/signIn/OxyEmailAccountChoice.js +113 -0
  16. package/lib/commonjs/ui/components/signIn/OxyEmailAccountChoice.js.map +1 -0
  17. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js +6 -2
  18. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -1
  19. package/lib/commonjs/ui/components/signIn/OxyPasswordPanel.js +4 -4
  20. package/lib/commonjs/ui/components/signIn/OxyPasswordPanel.js.map +1 -1
  21. package/lib/commonjs/ui/components/signIn/OxySignInPanel.js +76 -9
  22. package/lib/commonjs/ui/components/signIn/OxySignInPanel.js.map +1 -1
  23. package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js +6 -6
  24. package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js.map +1 -1
  25. package/lib/commonjs/ui/components/signIn/ReauthStep.js +4 -4
  26. package/lib/commonjs/ui/components/signIn/ReauthStep.js.map +1 -1
  27. package/lib/commonjs/ui/components/signIn/accountFlowParts.js +24 -22
  28. package/lib/commonjs/ui/components/signIn/accountFlowParts.js.map +1 -1
  29. package/lib/commonjs/ui/context/OxyContext.js +7 -4
  30. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  31. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +5 -2
  32. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  33. package/lib/commonjs/ui/oauth/applicationSessionLane.js +2 -2
  34. package/lib/commonjs/ui/oauth/applicationSessionLane.js.map +1 -1
  35. package/lib/commonjs/ui/screens/AccountMembersScreen.js +20 -63
  36. package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
  37. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +3 -3
  38. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  39. package/lib/commonjs/ui/screens/CreateAccountScreen.js +12 -12
  40. package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
  41. package/lib/commonjs/ui/screens/PreferencesScreen.js +3 -4
  42. package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -1
  43. package/lib/commonjs/ui/utils/identityCrypto.js +19 -0
  44. package/lib/commonjs/ui/utils/identityCrypto.js.map +1 -0
  45. package/lib/module/index.js +0 -4
  46. package/lib/module/index.js.map +1 -1
  47. package/lib/module/ui/boot/runProviderColdBoot.js +47 -3
  48. package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
  49. package/lib/module/ui/components/organizations/OrganizationClaimReview.js +2 -2
  50. package/lib/module/ui/components/organizations/OrganizationClaimReview.js.map +1 -1
  51. package/lib/module/ui/components/organizations/OrganizationDirectorySearch.js +5 -5
  52. package/lib/module/ui/components/organizations/OrganizationDirectorySearch.js.map +1 -1
  53. package/lib/module/ui/components/organizations/OrganizationSettings.js +4 -4
  54. package/lib/module/ui/components/organizations/OrganizationSettings.js.map +1 -1
  55. package/lib/module/ui/components/organizations/OrganizationTypePicker.js +1 -1
  56. package/lib/module/ui/components/organizations/OrganizationTypePicker.js.map +1 -1
  57. package/lib/module/ui/components/signIn/OxyAuthenticatorPanel.js +1 -1
  58. package/lib/module/ui/components/signIn/OxyAuthenticatorPanel.js.map +1 -1
  59. package/lib/module/ui/components/signIn/OxyEmailAccountChoice.js +110 -0
  60. package/lib/module/ui/components/signIn/OxyEmailAccountChoice.js.map +1 -0
  61. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js +5 -1
  62. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -1
  63. package/lib/module/ui/components/signIn/OxyPasswordPanel.js +1 -1
  64. package/lib/module/ui/components/signIn/OxyPasswordPanel.js.map +1 -1
  65. package/lib/module/ui/components/signIn/OxySignInPanel.js +71 -4
  66. package/lib/module/ui/components/signIn/OxySignInPanel.js.map +1 -1
  67. package/lib/module/ui/components/signIn/OxySignUpPanel.js +5 -5
  68. package/lib/module/ui/components/signIn/OxySignUpPanel.js.map +1 -1
  69. package/lib/module/ui/components/signIn/ReauthStep.js +1 -1
  70. package/lib/module/ui/components/signIn/ReauthStep.js.map +1 -1
  71. package/lib/module/ui/components/signIn/accountFlowParts.js +3 -1
  72. package/lib/module/ui/components/signIn/accountFlowParts.js.map +1 -1
  73. package/lib/module/ui/context/OxyContext.js +6 -3
  74. package/lib/module/ui/context/OxyContext.js.map +1 -1
  75. package/lib/module/ui/context/hooks/useAuthOperations.js +4 -1
  76. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  77. package/lib/module/ui/oauth/applicationSessionLane.js +2 -2
  78. package/lib/module/ui/oauth/applicationSessionLane.js.map +1 -1
  79. package/lib/module/ui/screens/AccountMembersScreen.js +20 -63
  80. package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
  81. package/lib/module/ui/screens/AccountSettingsScreen.js +2 -2
  82. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  83. package/lib/module/ui/screens/CreateAccountScreen.js +6 -6
  84. package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
  85. package/lib/module/ui/screens/PreferencesScreen.js +3 -4
  86. package/lib/module/ui/screens/PreferencesScreen.js.map +1 -1
  87. package/lib/module/ui/utils/identityCrypto.js +13 -0
  88. package/lib/module/ui/utils/identityCrypto.js.map +1 -0
  89. package/lib/typescript/commonjs/index.d.ts +0 -4
  90. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/ui/components/organizations/OrganizationClaimReview.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/ui/components/organizations/OrganizationDirectorySearch.d.ts +1 -1
  94. package/lib/typescript/commonjs/ui/components/organizations/OrganizationDirectorySearch.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/ui/components/organizations/OrganizationSettings.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/ui/components/organizations/OrganizationTypePicker.d.ts +1 -1
  97. package/lib/typescript/commonjs/ui/components/organizations/OrganizationTypePicker.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/ui/components/signIn/OxyAuthenticatorPanel.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/ui/components/signIn/OxyEmailAccountChoice.d.ts +20 -0
  100. package/lib/typescript/commonjs/ui/components/signIn/OxyEmailAccountChoice.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts +2 -0
  103. package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/ui/components/signIn/ReauthStep.d.ts +1 -1
  106. package/lib/typescript/commonjs/ui/components/signIn/ReauthStep.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts +1 -1
  108. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts.map +1 -1
  109. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +1 -7
  112. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/ui/hooks/queries/usePersonalPlans.d.ts +1 -2
  114. package/lib/typescript/commonjs/ui/hooks/queries/usePersonalPlans.d.ts.map +1 -1
  115. package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts +1 -1
  116. package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  118. package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/ui/screens/PreferencesScreen.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts +43 -0
  121. package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts.map +1 -0
  122. package/lib/typescript/module/index.d.ts +0 -4
  123. package/lib/typescript/module/index.d.ts.map +1 -1
  124. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  125. package/lib/typescript/module/ui/components/organizations/OrganizationClaimReview.d.ts.map +1 -1
  126. package/lib/typescript/module/ui/components/organizations/OrganizationDirectorySearch.d.ts +1 -1
  127. package/lib/typescript/module/ui/components/organizations/OrganizationDirectorySearch.d.ts.map +1 -1
  128. package/lib/typescript/module/ui/components/organizations/OrganizationSettings.d.ts.map +1 -1
  129. package/lib/typescript/module/ui/components/organizations/OrganizationTypePicker.d.ts +1 -1
  130. package/lib/typescript/module/ui/components/organizations/OrganizationTypePicker.d.ts.map +1 -1
  131. package/lib/typescript/module/ui/components/signIn/OxyAuthenticatorPanel.d.ts.map +1 -1
  132. package/lib/typescript/module/ui/components/signIn/OxyEmailAccountChoice.d.ts +20 -0
  133. package/lib/typescript/module/ui/components/signIn/OxyEmailAccountChoice.d.ts.map +1 -0
  134. package/lib/typescript/module/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -1
  135. package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts +2 -0
  136. package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
  137. package/lib/typescript/module/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
  138. package/lib/typescript/module/ui/components/signIn/ReauthStep.d.ts +1 -1
  139. package/lib/typescript/module/ui/components/signIn/ReauthStep.d.ts.map +1 -1
  140. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts +1 -1
  141. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts.map +1 -1
  142. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  143. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  144. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +1 -7
  145. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  146. package/lib/typescript/module/ui/hooks/queries/usePersonalPlans.d.ts +1 -2
  147. package/lib/typescript/module/ui/hooks/queries/usePersonalPlans.d.ts.map +1 -1
  148. package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts +1 -1
  149. package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
  150. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  151. package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  152. package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -1
  153. package/lib/typescript/module/ui/utils/identityCrypto.d.ts +43 -0
  154. package/lib/typescript/module/ui/utils/identityCrypto.d.ts.map +1 -0
  155. package/package.json +6 -7
  156. package/src/index.ts +0 -5
  157. package/src/ui/boot/__tests__/coldBootNoIdpRedirect.test.ts +166 -3
  158. package/src/ui/boot/runProviderColdBoot.ts +49 -4
  159. package/src/ui/components/organizations/OrganizationClaimReview.tsx +3 -5
  160. package/src/ui/components/organizations/OrganizationDirectorySearch.tsx +12 -9
  161. package/src/ui/components/organizations/OrganizationSettings.tsx +6 -9
  162. package/src/ui/components/organizations/OrganizationTypePicker.tsx +2 -1
  163. package/src/ui/components/signIn/OxyAuthenticatorPanel.tsx +2 -1
  164. package/src/ui/components/signIn/OxyEmailAccountChoice.tsx +116 -0
  165. package/src/ui/components/signIn/OxyLinkCommonsPanel.tsx +3 -1
  166. package/src/ui/components/signIn/OxyPasswordPanel.tsx +1 -1
  167. package/src/ui/components/signIn/OxySignInPanel.tsx +93 -6
  168. package/src/ui/components/signIn/OxySignUpPanel.tsx +6 -9
  169. package/src/ui/components/signIn/ReauthStep.tsx +2 -6
  170. package/src/ui/components/signIn/accountFlowParts.tsx +4 -2
  171. package/src/ui/context/OxyContext.tsx +7 -3
  172. package/src/ui/context/hooks/useAuthOperations.ts +2 -1
  173. package/src/ui/oauth/applicationSessionLane.ts +2 -2
  174. package/src/ui/screens/AccountMembersScreen.tsx +27 -71
  175. package/src/ui/screens/AccountSettingsScreen.tsx +6 -2
  176. package/src/ui/screens/CreateAccountScreen.tsx +10 -9
  177. package/src/ui/screens/PreferencesScreen.tsx +0 -2
  178. package/src/ui/utils/identityCrypto.ts +10 -0
  179. package/lib/commonjs/ui/components/AccountInvitationAcceptance.js +0 -97
  180. package/lib/commonjs/ui/components/AccountInvitationAcceptance.js.map +0 -1
  181. package/lib/commonjs/ui/components/DisplayCurrencySelector.js +0 -49
  182. package/lib/commonjs/ui/components/DisplayCurrencySelector.js.map +0 -1
  183. package/lib/commonjs/ui/hooks/useDisplayCurrency.js +0 -77
  184. package/lib/commonjs/ui/hooks/useDisplayCurrency.js.map +0 -1
  185. package/lib/commonjs/ui/hooks/useDisplayPrice.js +0 -59
  186. package/lib/commonjs/ui/hooks/useDisplayPrice.js.map +0 -1
  187. package/lib/module/ui/components/AccountInvitationAcceptance.js +0 -94
  188. package/lib/module/ui/components/AccountInvitationAcceptance.js.map +0 -1
  189. package/lib/module/ui/components/DisplayCurrencySelector.js +0 -44
  190. package/lib/module/ui/components/DisplayCurrencySelector.js.map +0 -1
  191. package/lib/module/ui/hooks/useDisplayCurrency.js +0 -72
  192. package/lib/module/ui/hooks/useDisplayCurrency.js.map +0 -1
  193. package/lib/module/ui/hooks/useDisplayPrice.js +0 -56
  194. package/lib/module/ui/hooks/useDisplayPrice.js.map +0 -1
  195. package/lib/typescript/commonjs/ui/components/AccountInvitationAcceptance.d.ts +0 -5
  196. package/lib/typescript/commonjs/ui/components/AccountInvitationAcceptance.d.ts.map +0 -1
  197. package/lib/typescript/commonjs/ui/components/DisplayCurrencySelector.d.ts +0 -3
  198. package/lib/typescript/commonjs/ui/components/DisplayCurrencySelector.d.ts.map +0 -1
  199. package/lib/typescript/commonjs/ui/hooks/useDisplayCurrency.d.ts +0 -11
  200. package/lib/typescript/commonjs/ui/hooks/useDisplayCurrency.d.ts.map +0 -1
  201. package/lib/typescript/commonjs/ui/hooks/useDisplayPrice.d.ts +0 -6
  202. package/lib/typescript/commonjs/ui/hooks/useDisplayPrice.d.ts.map +0 -1
  203. package/lib/typescript/module/ui/components/AccountInvitationAcceptance.d.ts +0 -5
  204. package/lib/typescript/module/ui/components/AccountInvitationAcceptance.d.ts.map +0 -1
  205. package/lib/typescript/module/ui/components/DisplayCurrencySelector.d.ts +0 -3
  206. package/lib/typescript/module/ui/components/DisplayCurrencySelector.d.ts.map +0 -1
  207. package/lib/typescript/module/ui/hooks/useDisplayCurrency.d.ts +0 -11
  208. package/lib/typescript/module/ui/hooks/useDisplayCurrency.d.ts.map +0 -1
  209. package/lib/typescript/module/ui/hooks/useDisplayPrice.d.ts +0 -6
  210. package/lib/typescript/module/ui/hooks/useDisplayPrice.d.ts.map +0 -1
  211. package/src/ui/components/AccountInvitationAcceptance.tsx +0 -90
  212. package/src/ui/components/DisplayCurrencySelector.tsx +0 -38
  213. package/src/ui/components/__tests__/AccountInvitationAcceptance.test.tsx +0 -61
  214. package/src/ui/hooks/useDisplayCurrency.ts +0 -64
  215. package/src/ui/hooks/useDisplayPrice.ts +0 -40
@@ -1,11 +0,0 @@
1
- import { type UserPreferences } from '@oxy.so/core';
2
- export type DisplayCurrency = NonNullable<UserPreferences['displayCurrency']>;
3
- export declare const DISPLAY_CURRENCIES: readonly DisplayCurrency[];
4
- /** Account-scoped server preference. A late save can never replace another account. */
5
- export declare function useDisplayCurrency(): {
6
- currency: DisplayCurrency;
7
- selectCurrency: (next: DisplayCurrency) => void;
8
- isSaving: boolean;
9
- error: Error | null;
10
- };
11
- //# sourceMappingURL=useDisplayCurrency.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDisplayCurrency.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useDisplayCurrency.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAO1E,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAC9E,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAA2B,CAAC;AAYrF,uFAAuF;AACvF,wBAAgB,kBAAkB;;2BA6BF,eAAe;;;EAW9C"}
@@ -1,6 +0,0 @@
1
- /** Display conversion only. Pricing and checkout request bodies retain their source units. */
2
- export declare function useDisplayPrice(): {
3
- currency: import("./useDisplayCurrency").DisplayCurrency;
4
- formatUsd: (minorUnits: number) => string;
5
- };
6
- //# sourceMappingURL=useDisplayPrice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDisplayPrice.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useDisplayPrice.ts"],"names":[],"mappings":"AAMA,8FAA8F;AAC9F,wBAAgB,eAAe;;4BAkBE,MAAM;EActC"}
@@ -1,5 +0,0 @@
1
- /** The link never grants access on navigation, preview, sign-in or account switching. */
2
- export declare function AccountInvitationAcceptance({ token }: {
3
- token: string;
4
- }): import("react").JSX.Element;
5
- //# sourceMappingURL=AccountInvitationAcceptance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccountInvitationAcceptance.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/AccountInvitationAcceptance.tsx"],"names":[],"mappings":"AAQA,yFAAyF;AACzF,wBAAgB,2BAA2B,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,+BAEvE"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare function DisplayCurrencySelector(): React.JSX.Element;
3
- //# sourceMappingURL=DisplayCurrencySelector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DisplayCurrencySelector.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/DisplayCurrencySelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,uBAAuB,sBA0BtC"}
@@ -1,11 +0,0 @@
1
- import { type UserPreferences } from '@oxy.so/core';
2
- export type DisplayCurrency = NonNullable<UserPreferences['displayCurrency']>;
3
- export declare const DISPLAY_CURRENCIES: readonly DisplayCurrency[];
4
- /** Account-scoped server preference. A late save can never replace another account. */
5
- export declare function useDisplayCurrency(): {
6
- currency: DisplayCurrency;
7
- selectCurrency: (next: DisplayCurrency) => void;
8
- isSaving: boolean;
9
- error: Error | null;
10
- };
11
- //# sourceMappingURL=useDisplayCurrency.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDisplayCurrency.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useDisplayCurrency.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAO1E,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAC9E,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAA2B,CAAC;AAYrF,uFAAuF;AACvF,wBAAgB,kBAAkB;;2BA6BF,eAAe;;;EAW9C"}
@@ -1,6 +0,0 @@
1
- /** Display conversion only. Pricing and checkout request bodies retain their source units. */
2
- export declare function useDisplayPrice(): {
3
- currency: import("./useDisplayCurrency.js").DisplayCurrency;
4
- formatUsd: (minorUnits: number) => string;
5
- };
6
- //# sourceMappingURL=useDisplayPrice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDisplayPrice.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useDisplayPrice.ts"],"names":[],"mappings":"AAMA,8FAA8F;AAC9F,wBAAgB,eAAe;;4BAkBE,MAAM;EActC"}
@@ -1,90 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { View } from 'react-native';
3
- import { Text } from '@oxy.so/bloom/typography';
4
- import { Button } from '@oxy.so/bloom/button';
5
- import type { AccountInvitationPreview } from '@oxy.so/core';
6
- import { getNormalizedUserHandle } from '@oxy.so/core';
7
- import { useOxy } from '../context/OxyContext';
8
-
9
- /** The link never grants access on navigation, preview, sign-in or account switching. */
10
- export function AccountInvitationAcceptance({ token }: { token: string }) {
11
- return <InvitationContent key={token} token={token} />;
12
- }
13
-
14
- function InvitationContent({ token }: { token: string }) {
15
- const { oxyServices, user, canUsePrivateApi, openAccountDialog } = useOxy();
16
- const [preview, setPreview] = useState<AccountInvitationPreview | null>(null);
17
- const [error, setError] = useState('');
18
- const [busy, setBusy] = useState(false);
19
- const [accepted, setAccepted] = useState(false);
20
- useEffect(() => {
21
- let alive = true;
22
- setPreview(null);
23
- setError('');
24
- if (canUsePrivateApi && token) {
25
- oxyServices.accounts.invitations
26
- .preview(token)
27
- .then((value) => {
28
- if (alive) setPreview(value);
29
- })
30
- .catch((reason) => {
31
- if (alive) setError(reason instanceof Error ? reason.message : 'Invitation unavailable');
32
- });
33
- }
34
- return () => {
35
- alive = false;
36
- };
37
- }, [oxyServices, canUsePrivateApi, token]);
38
-
39
- const accept = async () => {
40
- if (!user || !preview) return;
41
- setBusy(true);
42
- setError('');
43
- try {
44
- await oxyServices.accounts.invitations.accept(token, user.id);
45
- setAccepted(true);
46
- } catch (reason) {
47
- setError(reason instanceof Error ? reason.message : 'Could not accept invitation');
48
- } finally {
49
- setBusy(false);
50
- }
51
- };
52
- return (
53
- <View className="gap-space-16 p-space-24">
54
- <Text className="text-title font-semibold text-text">Account invitation</Text>
55
- {canUsePrivateApi && token && !preview && !error ? (
56
- <Text accessibilityRole="progressbar">Loading invitation…</Text>
57
- ) : null}
58
- {accepted ? (
59
- <Text>Invitation accepted. You can now access this account.</Text>
60
- ) : (
61
- <>
62
- {preview ? (
63
- <Text>
64
- Join {preview.account.displayName ?? preview.account.username} as{' '}
65
- {preview.invitation.role}.
66
- </Text>
67
- ) : null}
68
- <Text>
69
- Selected account:{' '}
70
- {user
71
- ? `${user.name?.displayName ?? getNormalizedUserHandle(user) ?? user.id} (${user.email ?? user.id})`
72
- : 'Not signed in'}
73
- </Text>
74
- <Text>
75
- The selected account receives access. Its email can differ from the invitation address.
76
- No access is granted until you confirm.
77
- </Text>
78
- <Button disabled={busy} onPress={() => openAccountDialog()}>
79
- {user ? 'Change account' : 'Sign in or create account'}
80
- </Button>
81
- <Button disabled={busy || !user || !preview || user.kind !== 'personal'} onPress={accept}>
82
- Confirm and accept
83
- </Button>
84
- </>
85
- )}
86
- {error ? <Text accessibilityRole="alert">{error}</Text> : null}
87
- {!token ? <Text>This invitation link is incomplete.</Text> : null}
88
- </View>
89
- );
90
- }
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import {
4
- SegmentedControl,
5
- SegmentedControlItem,
6
- SegmentedControlItemText,
7
- } from '@oxy.so/bloom/segmented-control';
8
- import { Text } from '@oxy.so/bloom/typography';
9
- import { DISPLAY_CURRENCIES, useDisplayCurrency } from '../hooks/useDisplayCurrency';
10
- import { useI18n } from '../hooks/useI18n';
11
-
12
- export function DisplayCurrencySelector() {
13
- const { currency, selectCurrency, isSaving, error } = useDisplayCurrency();
14
- const { t } = useI18n();
15
- return (
16
- <View>
17
- <Text>{t('preferences.displayCurrency.label')}</Text>
18
- <SegmentedControl
19
- type="radio"
20
- label={t('preferences.displayCurrency.label')}
21
- value={currency}
22
- onValueChange={(value) => {
23
- const selected = DISPLAY_CURRENCIES.find((item) => item === value);
24
- if (selected && !isSaving) selectCurrency(selected);
25
- }}
26
- >
27
- {DISPLAY_CURRENCIES.map((value) => (
28
- <SegmentedControlItem key={value} value={value} disabled={isSaving}>
29
- <SegmentedControlItemText>{value}</SegmentedControlItemText>
30
- </SegmentedControlItem>
31
- ))}
32
- </SegmentedControl>
33
- {error && (
34
- <Text accessibilityLiveRegion="polite">{t('preferences.displayCurrency.saveFailed')}</Text>
35
- )}
36
- </View>
37
- );
38
- }
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import { fireEvent, render, screen, waitFor } from '@testing-library/react';
3
- import { AccountInvitationAcceptance } from '../AccountInvitationAcceptance';
4
- const mockPreview = jest.fn();
5
- const mockAccept = jest.fn();
6
- const mockSwitch = jest.fn();
7
- let mockUser: { id: string; kind: string; email: string; username: string } | null = null;
8
- const mockServices = { accounts: { invitations: { preview: mockPreview, accept: mockAccept } } };
9
- jest.mock('../../context/OxyContext', () => ({
10
- useOxy: () => ({
11
- oxyServices: mockServices,
12
- user: mockUser,
13
- canUsePrivateApi: !!mockUser,
14
- openAccountDialog: mockSwitch,
15
- }),
16
- }));
17
- beforeEach(() => {
18
- jest.clearAllMocks();
19
- mockUser = null;
20
- mockPreview.mockResolvedValue({
21
- invitation: { role: 'editor' },
22
- account: { displayName: 'Community' },
23
- });
24
- mockAccept.mockResolvedValue({ success: true });
25
- });
26
- test('sign-in and switching never accept; confirmation names the displayed selected account', async () => {
27
- const { rerender } = render(<AccountInvitationAcceptance token="secret" />);
28
- fireEvent.click(screen.getByText('Sign in or create account'));
29
- expect(mockSwitch).toHaveBeenCalled();
30
- expect(mockAccept).not.toHaveBeenCalled();
31
- mockUser = { id: 'first', kind: 'personal', username: 'first', email: 'different@example.com' };
32
- rerender(<AccountInvitationAcceptance token="secret" />);
33
- await screen.findByText('Join Community as editor.');
34
- fireEvent.click(screen.getByText('Change account'));
35
- expect(mockAccept).not.toHaveBeenCalled();
36
- mockUser = { id: 'second', kind: 'personal', username: 'second', email: 'second@example.com' };
37
- rerender(<AccountInvitationAcceptance token="secret" />);
38
- expect(screen.getByText(/Selected account: second/)).toBeTruthy();
39
- fireEvent.click(screen.getByText('Confirm and accept'));
40
- await waitFor(() => expect(mockAccept).toHaveBeenCalledWith('secret', 'second'));
41
- await screen.findByText('Invitation accepted. You can now access this account.');
42
- });
43
- test('a new link resets previous acceptance and does not auto-accept', async () => {
44
- mockUser = { id: 'first', kind: 'personal', username: 'first', email: 'first@example.com' };
45
- const { rerender } = render(<AccountInvitationAcceptance token="old" />);
46
- await screen.findByText('Join Community as editor.');
47
- fireEvent.click(screen.getByText('Confirm and accept'));
48
- await screen.findByText('Invitation accepted. You can now access this account.');
49
- rerender(<AccountInvitationAcceptance token="new" />);
50
- await screen.findByText('Join Community as editor.');
51
- expect(screen.queryByText('Invitation accepted. You can now access this account.')).toBeNull();
52
- expect(mockAccept).toHaveBeenCalledTimes(1);
53
- });
54
- test('preview failure leaves confirmation disabled', async () => {
55
- mockUser = { id: 'first', kind: 'personal', username: 'first', email: 'first@example.com' };
56
- mockPreview.mockRejectedValue(new Error('Invitation expired'));
57
- render(<AccountInvitationAcceptance token="expired" />);
58
- await screen.findByText('Invitation expired');
59
- fireEvent.click(screen.getByText('Confirm and accept'));
60
- expect(mockAccept).not.toHaveBeenCalled();
61
- });
@@ -1,64 +0,0 @@
1
- import { useSyncExternalStore } from 'react';
2
- import { useMutation, useQueryClient } from '@tanstack/react-query';
3
- import { authenticatedApiCall, type UserPreferences } from '@oxy.so/core';
4
- import { useOxy } from '../context/OxyContext';
5
- import { useCurrentUser } from './queries/useAccountQueries';
6
- import { queryKeys } from './queries/queryKeys';
7
- import { useAuthStore } from '../stores/authStore';
8
- import { mutationKeys } from './mutations/mutationKeys';
9
-
10
- export type DisplayCurrency = NonNullable<UserPreferences['displayCurrency']>;
11
- export const DISPLAY_CURRENCIES: readonly DisplayCurrency[] = ['USD', 'EUR', 'FAIR'];
12
-
13
- let anonymousCurrency: DisplayCurrency = 'USD';
14
- const anonymousListeners = new Set<() => void>();
15
- const subscribeAnonymous = (listener: () => void) => {
16
- anonymousListeners.add(listener);
17
- return () => {
18
- anonymousListeners.delete(listener);
19
- };
20
- };
21
- const anonymousSnapshot = () => anonymousCurrency;
22
-
23
- /** Account-scoped server preference. A late save can never replace another account. */
24
- export function useDisplayCurrency() {
25
- const { oxyServices, activeSessionId, isAuthenticated, user } = useOxy();
26
- const current = useCurrentUser({ enabled: isAuthenticated });
27
- const client = useQueryClient();
28
- const anonymous = useSyncExternalStore(
29
- subscribeAnonymous,
30
- anonymousSnapshot,
31
- () => 'USD' as const,
32
- );
33
- const currency = isAuthenticated
34
- ? (current.data?.userPreferences?.displayCurrency ??
35
- user?.userPreferences?.displayCurrency ??
36
- 'USD')
37
- : anonymous;
38
- const mutation = useMutation({
39
- mutationKey: [...mutationKeys.account.updateSettings],
40
- mutationFn: async (input: { currency: DisplayCurrency; sessionId: string; userId: string }) => {
41
- const updated = await authenticatedApiCall(oxyServices, input.sessionId, () =>
42
- oxyServices.users.updateMe({ userPreferences: { displayCurrency: input.currency } }),
43
- );
44
- if (updated.id !== input.userId) throw new Error('Account changed. Please try again.');
45
- return updated;
46
- },
47
- onSuccess: (updated, input) => {
48
- client.setQueryData(queryKeys.accounts.current(input.sessionId), updated);
49
- if (useAuthStore.getState().user?.id === input.userId)
50
- useAuthStore.getState().setUser(updated);
51
- },
52
- });
53
- function selectCurrency(next: DisplayCurrency) {
54
- if (!DISPLAY_CURRENCIES.includes(next)) return;
55
- if (!isAuthenticated) {
56
- anonymousCurrency = next;
57
- for (const listener of anonymousListeners) listener();
58
- return;
59
- }
60
- if (activeSessionId && user?.id)
61
- mutation.mutate({ currency: next, sessionId: activeSessionId, userId: user.id });
62
- }
63
- return { currency, selectCurrency, isSaving: mutation.isPending, error: mutation.error };
64
- }
@@ -1,40 +0,0 @@
1
- import { useQuery } from '@tanstack/react-query';
2
- import { useEffect, useState } from 'react';
3
- import { convertDisplayAmount, readDisplayRates } from '@peable.to/sdk/display';
4
- import { useDisplayCurrency } from './useDisplayCurrency';
5
- import { useI18n } from './useI18n';
6
-
7
- /** Display conversion only. Pricing and checkout request bodies retain their source units. */
8
- export function useDisplayPrice() {
9
- const { currency } = useDisplayCurrency();
10
- const { t } = useI18n();
11
- const [now, setNow] = useState(Date.now);
12
- const rates = useQuery({
13
- queryKey: ['display-currency', 'faircoin-indexed-price'],
14
- queryFn: ({ signal }) => readDisplayRates({ signal }),
15
- enabled: currency !== 'USD',
16
- staleTime: 30_000,
17
- gcTime: 0,
18
- retry: false,
19
- refetchInterval: 60_000,
20
- refetchOnWindowFocus: 'always',
21
- });
22
- useEffect(() => {
23
- const timer = setInterval(() => setNow(Date.now()), 1000);
24
- return () => clearInterval(timer);
25
- }, []);
26
- function formatUsd(minorUnits: number) {
27
- const display = convertDisplayAmount({
28
- units: String(minorUnits),
29
- currency: 'USD',
30
- displayCurrency: currency,
31
- rates: rates.isError ? null : rates.data,
32
- now,
33
- });
34
- if (!display) return t('preferences.displayCurrency.unavailable', { currency });
35
- return currency === 'USD'
36
- ? display
37
- : t('preferences.displayCurrency.approximate', { amount: display });
38
- }
39
- return { currency, formatUsd };
40
- }