@fluid-app/portal-sdk 0.1.106 → 0.1.108

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 (133) hide show
  1. package/dist/{AppDownloadScreen-BBpvNeFO.mjs → AppDownloadScreen-BvcyEKCk.mjs} +2 -2
  2. package/dist/{AppDownloadScreen-BBpvNeFO.mjs.map → AppDownloadScreen-BvcyEKCk.mjs.map} +1 -1
  3. package/dist/{AppDownloadScreen-Da79ffTK.cjs → AppDownloadScreen-DzFc_CDn.cjs} +2 -2
  4. package/dist/{AppDownloadScreen-Da79ffTK.cjs.map → AppDownloadScreen-DzFc_CDn.cjs.map} +1 -1
  5. package/dist/{AppDownloadScreen-R3rcFWzL.cjs → AppDownloadScreen-Uc9N7K_K.cjs} +2 -2
  6. package/dist/{ContactsScreen-CGyCNeZy.mjs → ContactsScreen-BNqIi0XS.mjs} +5 -5
  7. package/dist/{ContactsScreen-CGyCNeZy.mjs.map → ContactsScreen-BNqIi0XS.mjs.map} +1 -1
  8. package/dist/{ContactsScreen-CFC32ATZ.cjs → ContactsScreen-C6cCTl51.cjs} +5 -5
  9. package/dist/{ContactsScreen-CFC32ATZ.cjs.map → ContactsScreen-C6cCTl51.cjs.map} +1 -1
  10. package/dist/{ContactsScreen-D81raD2s.cjs → ContactsScreen-D2DYk3A-.cjs} +6 -6
  11. package/dist/{FluidProvider-DbYLBGGg.cjs → FluidProvider-NnE6s3O0.cjs} +6 -458
  12. package/dist/FluidProvider-NnE6s3O0.cjs.map +1 -0
  13. package/dist/{FluidProvider-B59bzF__.mjs → FluidProvider-dTwaHRzI.mjs} +7 -483
  14. package/dist/FluidProvider-dTwaHRzI.mjs.map +1 -0
  15. package/dist/{MessagingScreen-TCOhXTPN.cjs → MessagingScreen-C_tCav2Y.cjs} +4 -4
  16. package/dist/{MessagingScreen-DsH-L7vB.cjs → MessagingScreen-DH0YxaOG.cjs} +8 -10
  17. package/dist/{MessagingScreen-DsH-L7vB.cjs.map → MessagingScreen-DH0YxaOG.cjs.map} +1 -1
  18. package/dist/{MessagingScreen-6SfuZqDC.mjs → MessagingScreen-Dv8HVEt-.mjs} +8 -10
  19. package/dist/MessagingScreen-Dv8HVEt-.mjs.map +1 -0
  20. package/dist/{MessagingScreen-Bg-7zNye.mjs → MessagingScreen-IzNlAXvD.mjs} +4 -4
  21. package/dist/{MySiteScreen-DDX4xcMv.cjs → MySiteScreen-Bda8FzQ9.cjs} +3 -3
  22. package/dist/{MySiteScreen-BHiMCIZ_.cjs → MySiteScreen-DydtAGvt.cjs} +3 -3
  23. package/dist/{MySiteScreen-BHiMCIZ_.cjs.map → MySiteScreen-DydtAGvt.cjs.map} +1 -1
  24. package/dist/{MySiteScreen-BI089vJc.mjs → MySiteScreen-t89PLodk.mjs} +3 -3
  25. package/dist/{MySiteScreen-BI089vJc.mjs.map → MySiteScreen-t89PLodk.mjs.map} +1 -1
  26. package/dist/{OrdersScreen-BQVbdyrZ.cjs → OrdersScreen-BhJkW3TG.cjs} +4 -4
  27. package/dist/{OrdersScreen-BQVbdyrZ.cjs.map → OrdersScreen-BhJkW3TG.cjs.map} +1 -1
  28. package/dist/{OrdersScreen-CaESWLWt.mjs → OrdersScreen-DP1WdqVT.mjs} +4 -4
  29. package/dist/{OrdersScreen-CaESWLWt.mjs.map → OrdersScreen-DP1WdqVT.mjs.map} +1 -1
  30. package/dist/{OrdersScreen-BsPW-2wm.cjs → OrdersScreen-DvaV61fj.cjs} +3 -3
  31. package/dist/{ProductsScreen-Bp_XLYgP.mjs → ProductsScreen-CFLI7j5s.mjs} +7 -7
  32. package/dist/{ProductsScreen-BFnsUrY1.cjs → ProductsScreen-CI9G5UJh.cjs} +7 -7
  33. package/dist/{ProductsScreen-ClC1fTWG.mjs → ProductsScreen-sEcByLGy.mjs} +5 -5
  34. package/dist/{ProductsScreen-ClC1fTWG.mjs.map → ProductsScreen-sEcByLGy.mjs.map} +1 -1
  35. package/dist/{ProductsScreen-D-mnWuJW.cjs → ProductsScreen-ssonMzdl.cjs} +5 -5
  36. package/dist/{ProductsScreen-D-mnWuJW.cjs.map → ProductsScreen-ssonMzdl.cjs.map} +1 -1
  37. package/dist/{ProfileScreen-COpbffE9.cjs → ProfileScreen-BPvudlCM.cjs} +10 -9
  38. package/dist/{ProfileScreen-COpbffE9.cjs.map → ProfileScreen-BPvudlCM.cjs.map} +1 -1
  39. package/dist/{ProfileScreen-B1zSJuVE.mjs → ProfileScreen-BWiBC4y3.mjs} +10 -9
  40. package/dist/{ProfileScreen-B1zSJuVE.mjs.map → ProfileScreen-BWiBC4y3.mjs.map} +1 -1
  41. package/dist/{ProfileScreen-p9Zqln4n.cjs → ProfileScreen-Bc4znBmb.cjs} +2 -2
  42. package/dist/{ShareablesScreen-BSOBA2bP.cjs → ShareablesScreen-BvBfPJ69.cjs} +7 -7
  43. package/dist/{ShareablesScreen-BOwl9-B0.mjs → ShareablesScreen-CIrWSh5q.mjs} +8 -7
  44. package/dist/{ShareablesScreen-BOwl9-B0.mjs.map → ShareablesScreen-CIrWSh5q.mjs.map} +1 -1
  45. package/dist/{ShareablesScreen-Bmghdz71.mjs → ShareablesScreen-CtQckby8.mjs} +7 -7
  46. package/dist/{ShareablesScreen-9toTptRT.cjs → ShareablesScreen-D3JVKFVA.cjs} +9 -8
  47. package/dist/{ShareablesScreen-9toTptRT.cjs.map → ShareablesScreen-D3JVKFVA.cjs.map} +1 -1
  48. package/dist/{ShopScreen-Cbv-zrHK.cjs → ShopScreen-BTTKNmtT.cjs} +6 -7
  49. package/dist/ShopScreen-BTTKNmtT.cjs.map +1 -0
  50. package/dist/{ShopScreen-BwNZxqnT.mjs → ShopScreen-CDscN4-a.mjs} +6 -7
  51. package/dist/{ShopScreen-BwNZxqnT.mjs.map → ShopScreen-CDscN4-a.mjs.map} +1 -1
  52. package/dist/{ShopScreen-M2hCxrwQ.cjs → ShopScreen-TWpb8sxs.cjs} +2 -2
  53. package/dist/{SubscriptionsScreen-CJwOjaBY.cjs → SubscriptionsScreen-B0drtNfN.cjs} +4 -4
  54. package/dist/{SubscriptionsScreen-CJwOjaBY.cjs.map → SubscriptionsScreen-B0drtNfN.cjs.map} +1 -1
  55. package/dist/{SubscriptionsScreen-YsIehRb5.mjs → SubscriptionsScreen-D-BXah4H.mjs} +4 -4
  56. package/dist/{SubscriptionsScreen-YsIehRb5.mjs.map → SubscriptionsScreen-D-BXah4H.mjs.map} +1 -1
  57. package/dist/{SubscriptionsScreen-Bfu-mgGS.cjs → SubscriptionsScreen-WtnN9Ka0.cjs} +4 -4
  58. package/dist/{UpgradeScreen-DI7DK6qt.cjs → UpgradeScreen-C-aIQL-y.cjs} +1 -1
  59. package/dist/{UpgradeScreen-DI7DK6qt.cjs.map → UpgradeScreen-C-aIQL-y.cjs.map} +1 -1
  60. package/dist/{UpgradeScreen-DfDZG52l.cjs → UpgradeScreen-CWgcMBwb.cjs} +1 -1
  61. package/dist/{UpgradeScreen-CTXUueQY.mjs → UpgradeScreen-GTOZCURK.mjs} +1 -1
  62. package/dist/{UpgradeScreen-CTXUueQY.mjs.map → UpgradeScreen-GTOZCURK.mjs.map} +1 -1
  63. package/dist/{dist-oYNtEpKP.mjs → dist-B1HwSrso.mjs} +2 -2
  64. package/dist/{dist-oYNtEpKP.mjs.map → dist-B1HwSrso.mjs.map} +1 -1
  65. package/dist/{dist-BSbac3uh.cjs → dist-BF_4vk1z.cjs} +1 -1
  66. package/dist/{dist-BSbac3uh.cjs.map → dist-BF_4vk1z.cjs.map} +1 -1
  67. package/dist/{dist-DRVtlgQ1.cjs → dist-BbS_7TvS.cjs} +1 -1
  68. package/dist/{dist-DRVtlgQ1.cjs.map → dist-BbS_7TvS.cjs.map} +1 -1
  69. package/dist/{dist-NMbUD0qE.mjs → dist-CMGXkSgZ.mjs} +1 -1
  70. package/dist/{dist-NMbUD0qE.mjs.map → dist-CMGXkSgZ.mjs.map} +1 -1
  71. package/dist/{dist-Ck9MGRmE.cjs → dist-DkYXiQQ1.cjs} +2 -2
  72. package/dist/{dist-Ck9MGRmE.cjs.map → dist-DkYXiQQ1.cjs.map} +1 -1
  73. package/dist/{es-BCKjXBqj.mjs → es-B84KtbcD.mjs} +1 -1
  74. package/dist/{es-BCKjXBqj.mjs.map → es-B84KtbcD.mjs.map} +1 -1
  75. package/dist/{es-DlWO6buB.cjs → es-BSkb3AZk.cjs} +1 -1
  76. package/dist/{es-DlWO6buB.cjs.map → es-BSkb3AZk.cjs.map} +1 -1
  77. package/dist/index.cjs +54 -75
  78. package/dist/index.cjs.map +1 -1
  79. package/dist/index.d.cts +70 -185
  80. package/dist/index.d.cts.map +1 -1
  81. package/dist/index.d.mts +70 -185
  82. package/dist/index.d.mts.map +1 -1
  83. package/dist/index.mjs +53 -59
  84. package/dist/index.mjs.map +1 -1
  85. package/dist/{order-detail-CtTwAXfP.mjs → order-detail-B8jb-YB6.mjs} +1 -1
  86. package/dist/{order-detail-CtTwAXfP.mjs.map → order-detail-B8jb-YB6.mjs.map} +1 -1
  87. package/dist/{order-detail-CksE8d5w.cjs → order-detail-Bq7_UZ75.cjs} +1 -1
  88. package/dist/{order-detail-CksE8d5w.cjs.map → order-detail-Bq7_UZ75.cjs.map} +1 -1
  89. package/dist/{products-BAtIML76.cjs → products-3BKfOxrs.cjs} +1 -1
  90. package/dist/{products-BAtIML76.cjs.map → products-3BKfOxrs.cjs.map} +1 -1
  91. package/dist/{products-StJIeia3.mjs → products-DtutnMu9.mjs} +1 -1
  92. package/dist/{products-StJIeia3.mjs.map → products-DtutnMu9.mjs.map} +1 -1
  93. package/dist/{sortable.esm-DSrWP4x9.mjs → sortable.esm-Cz-CP2N8.mjs} +1 -1
  94. package/dist/{sortable.esm-DSrWP4x9.mjs.map → sortable.esm-Cz-CP2N8.mjs.map} +1 -1
  95. package/dist/{src-DryOJTBW.mjs → src-CN7diUEw.mjs} +1 -1
  96. package/dist/{src-DryOJTBW.mjs.map → src-CN7diUEw.mjs.map} +1 -1
  97. package/dist/{src-xEfkv04t.cjs → src-D5RNExKx.cjs} +6 -6
  98. package/dist/{src-xEfkv04t.cjs.map → src-D5RNExKx.cjs.map} +1 -1
  99. package/dist/{src-DjlwUaws.mjs → src-Dhvv96Yt.mjs} +6 -6
  100. package/dist/{src-DjlwUaws.mjs.map → src-Dhvv96Yt.mjs.map} +1 -1
  101. package/dist/{src-CMByt6YP.cjs → src-Zv3-NSUf.cjs} +1 -1
  102. package/dist/{src-CMByt6YP.cjs.map → src-Zv3-NSUf.cjs.map} +1 -1
  103. package/dist/{use-account-clients-CFM5q2J-.cjs → use-account-clients-CDTUFb6O.cjs} +5 -70
  104. package/dist/use-account-clients-CDTUFb6O.cjs.map +1 -0
  105. package/dist/{use-account-clients-BVe69HZV.mjs → use-account-clients-vDDhNW8x.mjs} +6 -65
  106. package/dist/use-account-clients-vDDhNW8x.mjs.map +1 -0
  107. package/dist/{use-current-user-CrHH290V.cjs → use-current-user-C7O5SJ_L.cjs} +3 -3
  108. package/dist/{use-current-user-CrHH290V.cjs.map → use-current-user-C7O5SJ_L.cjs.map} +1 -1
  109. package/dist/{use-current-user-SmbdS--3.mjs → use-current-user-Czzb9Zc4.mjs} +3 -3
  110. package/dist/{use-current-user-SmbdS--3.mjs.map → use-current-user-Czzb9Zc4.mjs.map} +1 -1
  111. package/dist/{use-customer-account-C1ypS2wX.mjs → use-customer-account-DHZ8wLs9.mjs} +6 -7
  112. package/dist/use-customer-account-DHZ8wLs9.mjs.map +1 -0
  113. package/dist/{use-customer-account-_IaCM92S.cjs → use-customer-account-zgiEdZ89.cjs} +6 -7
  114. package/dist/use-customer-account-zgiEdZ89.cjs.map +1 -0
  115. package/dist/{use-fluid-api-f1PKU6dS.mjs → use-fluid-api-D0kldm0L.mjs} +2 -2
  116. package/dist/{use-fluid-api-f1PKU6dS.mjs.map → use-fluid-api-D0kldm0L.mjs.map} +1 -1
  117. package/dist/{use-fluid-api-C2evcv_D.cjs → use-fluid-api-Wjw57-uD.cjs} +2 -2
  118. package/dist/{use-fluid-api-C2evcv_D.cjs.map → use-fluid-api-Wjw57-uD.cjs.map} +1 -1
  119. package/dist/use-fluid-auth-BPwsWZNu.cjs +50 -0
  120. package/dist/use-fluid-auth-BPwsWZNu.cjs.map +1 -0
  121. package/dist/use-fluid-auth-Dy5K7BQ9.mjs +45 -0
  122. package/dist/use-fluid-auth-Dy5K7BQ9.mjs.map +1 -0
  123. package/package.json +9 -9
  124. package/dist/FluidProvider-B59bzF__.mjs.map +0 -1
  125. package/dist/FluidProvider-DbYLBGGg.cjs.map +0 -1
  126. package/dist/MessagingScreen-6SfuZqDC.mjs.map +0 -1
  127. package/dist/ShopScreen-Cbv-zrHK.cjs.map +0 -1
  128. package/dist/use-account-clients-BVe69HZV.mjs.map +0 -1
  129. package/dist/use-account-clients-CFM5q2J-.cjs.map +0 -1
  130. package/dist/use-customer-account-C1ypS2wX.mjs.map +0 -1
  131. package/dist/use-customer-account-_IaCM92S.cjs.map +0 -1
  132. /package/dist/{src-BakNjVTk.mjs → src-B7j_mfeS.mjs} +0 -0
  133. /package/dist/{src-C_kOrGdZ.cjs → src-Bp-dRR29.cjs} +0 -0
@@ -1142,325 +1142,6 @@ const URL_PARAMS = {
1142
1142
  function isBrowser() {
1143
1143
  return typeof window !== "undefined" && typeof document !== "undefined";
1144
1144
  }
1145
- new TextEncoder();
1146
- const decoder = new TextDecoder();
1147
- const decodeBase64 = (encoded) => {
1148
- const binary = atob(encoded);
1149
- const bytes = new Uint8Array(binary.length);
1150
- for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
1151
- return bytes;
1152
- };
1153
- const decode$1 = (input) => {
1154
- let encoded = input;
1155
- if (encoded instanceof Uint8Array) encoded = decoder.decode(encoded);
1156
- encoded = encoded.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
1157
- try {
1158
- return decodeBase64(encoded);
1159
- } catch {
1160
- throw new TypeError("The input to be decoded is not correctly encoded.");
1161
- }
1162
- };
1163
- //#endregion
1164
- //#region ../../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/browser/util/errors.js
1165
- var JOSEError = class extends Error {
1166
- constructor(message, options) {
1167
- super(message, options);
1168
- this.code = "ERR_JOSE_GENERIC";
1169
- this.name = this.constructor.name;
1170
- Error.captureStackTrace?.(this, this.constructor);
1171
- }
1172
- };
1173
- JOSEError.code = "ERR_JOSE_GENERIC";
1174
- var JWTClaimValidationFailed = class extends JOSEError {
1175
- constructor(message, payload, claim = "unspecified", reason = "unspecified") {
1176
- super(message, { cause: {
1177
- claim,
1178
- reason,
1179
- payload
1180
- } });
1181
- this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
1182
- this.claim = claim;
1183
- this.reason = reason;
1184
- this.payload = payload;
1185
- }
1186
- };
1187
- JWTClaimValidationFailed.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
1188
- var JWTExpired = class extends JOSEError {
1189
- constructor(message, payload, claim = "unspecified", reason = "unspecified") {
1190
- super(message, { cause: {
1191
- claim,
1192
- reason,
1193
- payload
1194
- } });
1195
- this.code = "ERR_JWT_EXPIRED";
1196
- this.claim = claim;
1197
- this.reason = reason;
1198
- this.payload = payload;
1199
- }
1200
- };
1201
- JWTExpired.code = "ERR_JWT_EXPIRED";
1202
- var JOSEAlgNotAllowed = class extends JOSEError {
1203
- constructor() {
1204
- super(...arguments);
1205
- this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
1206
- }
1207
- };
1208
- JOSEAlgNotAllowed.code = "ERR_JOSE_ALG_NOT_ALLOWED";
1209
- var JOSENotSupported = class extends JOSEError {
1210
- constructor() {
1211
- super(...arguments);
1212
- this.code = "ERR_JOSE_NOT_SUPPORTED";
1213
- }
1214
- };
1215
- JOSENotSupported.code = "ERR_JOSE_NOT_SUPPORTED";
1216
- var JWEDecryptionFailed = class extends JOSEError {
1217
- constructor(message = "decryption operation failed", options) {
1218
- super(message, options);
1219
- this.code = "ERR_JWE_DECRYPTION_FAILED";
1220
- }
1221
- };
1222
- JWEDecryptionFailed.code = "ERR_JWE_DECRYPTION_FAILED";
1223
- var JWEInvalid = class extends JOSEError {
1224
- constructor() {
1225
- super(...arguments);
1226
- this.code = "ERR_JWE_INVALID";
1227
- }
1228
- };
1229
- JWEInvalid.code = "ERR_JWE_INVALID";
1230
- var JWSInvalid = class extends JOSEError {
1231
- constructor() {
1232
- super(...arguments);
1233
- this.code = "ERR_JWS_INVALID";
1234
- }
1235
- };
1236
- JWSInvalid.code = "ERR_JWS_INVALID";
1237
- var JWTInvalid = class extends JOSEError {
1238
- constructor() {
1239
- super(...arguments);
1240
- this.code = "ERR_JWT_INVALID";
1241
- }
1242
- };
1243
- JWTInvalid.code = "ERR_JWT_INVALID";
1244
- var JWKInvalid = class extends JOSEError {
1245
- constructor() {
1246
- super(...arguments);
1247
- this.code = "ERR_JWK_INVALID";
1248
- }
1249
- };
1250
- JWKInvalid.code = "ERR_JWK_INVALID";
1251
- var JWKSInvalid = class extends JOSEError {
1252
- constructor() {
1253
- super(...arguments);
1254
- this.code = "ERR_JWKS_INVALID";
1255
- }
1256
- };
1257
- JWKSInvalid.code = "ERR_JWKS_INVALID";
1258
- var JWKSNoMatchingKey = class extends JOSEError {
1259
- constructor(message = "no applicable key found in the JSON Web Key Set", options) {
1260
- super(message, options);
1261
- this.code = "ERR_JWKS_NO_MATCHING_KEY";
1262
- }
1263
- };
1264
- JWKSNoMatchingKey.code = "ERR_JWKS_NO_MATCHING_KEY";
1265
- var JWKSMultipleMatchingKeys = class extends JOSEError {
1266
- constructor(message = "multiple matching keys found in the JSON Web Key Set", options) {
1267
- super(message, options);
1268
- this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
1269
- }
1270
- };
1271
- JWKSMultipleMatchingKeys.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
1272
- var JWKSTimeout = class extends JOSEError {
1273
- constructor(message = "request timed out", options) {
1274
- super(message, options);
1275
- this.code = "ERR_JWKS_TIMEOUT";
1276
- }
1277
- };
1278
- JWKSTimeout.code = "ERR_JWKS_TIMEOUT";
1279
- var JWSSignatureVerificationFailed = class extends JOSEError {
1280
- constructor(message = "signature verification failed", options) {
1281
- super(message, options);
1282
- this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
1283
- }
1284
- };
1285
- JWSSignatureVerificationFailed.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
1286
- //#endregion
1287
- //#region ../../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/browser/lib/is_object.js
1288
- function isObjectLike(value) {
1289
- return typeof value === "object" && value !== null;
1290
- }
1291
- function isObject(input) {
1292
- if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") return false;
1293
- if (Object.getPrototypeOf(input) === null) return true;
1294
- let proto = input;
1295
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
1296
- return Object.getPrototypeOf(input) === proto;
1297
- }
1298
- const decode = decode$1;
1299
- //#endregion
1300
- //#region ../../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/browser/util/decode_jwt.js
1301
- function decodeJwt(jwt) {
1302
- if (typeof jwt !== "string") throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");
1303
- const { 1: payload, length } = jwt.split(".");
1304
- if (length === 5) throw new JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");
1305
- if (length !== 3) throw new JWTInvalid("Invalid JWT");
1306
- if (!payload) throw new JWTInvalid("JWTs must contain a payload");
1307
- let decoded;
1308
- try {
1309
- decoded = decode(payload);
1310
- } catch {
1311
- throw new JWTInvalid("Failed to base64url decode the payload");
1312
- }
1313
- let result;
1314
- try {
1315
- result = JSON.parse(decoder.decode(decoded));
1316
- } catch {
1317
- throw new JWTInvalid("Failed to parse the decoded payload as JSON");
1318
- }
1319
- if (!isObject(result)) throw new JWTInvalid("Invalid JWT Claims Set");
1320
- return result;
1321
- }
1322
- //#endregion
1323
- //#region ../../platform/auth/src/token-utils.ts
1324
- /**
1325
- * Token Utilities
1326
- *
1327
- * Functions for decoding, validating, and checking JWT tokens.
1328
- */
1329
- /**
1330
- * Extract a JWTPayload from a jose-decoded JWT payload.
1331
- *
1332
- * Type assertions are required because jose's payload type uses `unknown`
1333
- * for custom claims. This helper centralises the mapping so that
1334
- * both {@link decodeToken} and {@link verifyToken} share the same logic.
1335
- */
1336
- function extractPayloadFromJose(decoded) {
1337
- const rawUserType = decoded.user_type;
1338
- const rawOgUserType = decoded.og_user_type;
1339
- return {
1340
- id: typeof decoded.id === "number" ? decoded.id : void 0,
1341
- email: typeof decoded.email === "string" ? decoded.email : void 0,
1342
- full_name: typeof decoded.full_name === "string" ? decoded.full_name : void 0,
1343
- user_type: typeof rawUserType === "string" && isUserType(rawUserType) ? rawUserType : "rep",
1344
- og_user_type: typeof rawOgUserType === "string" && isUserType(rawOgUserType) ? rawOgUserType : void 0,
1345
- company_id: typeof decoded.company_id === "number" ? decoded.company_id : void 0,
1346
- exp: decoded.exp,
1347
- auth_type: typeof decoded.auth_type === "string" ? decoded.auth_type : void 0
1348
- };
1349
- }
1350
- /**
1351
- * Decode a JWT token and extract its payload.
1352
- *
1353
- * **Security note:** This function does NOT verify the JWT signature.
1354
- * It only decodes the payload. Any valid JWT structure will be accepted,
1355
- * regardless of who signed it.
1356
- *
1357
- * Client-side token decoding is used for UX purposes only (displaying
1358
- * user info, role-based UI). The real security boundary is the server-side
1359
- * API, which verifies the signature on every request.
1360
- *
1361
- * For signature verification, use {@link verifyToken} with a JWKS URL.
1362
- *
1363
- * @param token - The JWT token string
1364
- * @returns The decoded JWT payload, or null if decoding fails
1365
- */
1366
- function decodeToken(token) {
1367
- try {
1368
- return extractPayloadFromJose(decodeJwt(token));
1369
- } catch (error) {
1370
- console.error("[FluidAuth] Failed to decode JWT token:", error);
1371
- return null;
1372
- }
1373
- }
1374
- /**
1375
- * Check if a token has expired.
1376
- * Includes a configurable grace period to account for clock skew.
1377
- *
1378
- * @param token - The JWT token string
1379
- * @param gracePeriodMs - Grace period in milliseconds (default: 30 seconds)
1380
- * @returns true if the token is expired, false otherwise
1381
- */
1382
- function isTokenExpired(token, gracePeriodMs = AUTH_CONSTANTS.TOKEN_GRACE_PERIOD_MS) {
1383
- try {
1384
- const decoded = decodeJwt(token);
1385
- if (!decoded.exp) return false;
1386
- const expirationTime = decoded.exp * 1e3;
1387
- return Date.now() > expirationTime + gracePeriodMs;
1388
- } catch {
1389
- return true;
1390
- }
1391
- }
1392
- /**
1393
- * Validate a JWT token for format and expiration.
1394
- *
1395
- * **Security note:** This function checks JWT structure and expiration
1396
- * but does NOT verify the signature. It is a UX-level check only.
1397
- * For signature verification, use {@link verifyToken} with a JWKS URL.
1398
- *
1399
- * @param token - The JWT token string
1400
- * @param gracePeriodMs - Grace period for expiration check (default: 30 seconds)
1401
- * @returns Validation result with status and decoded payload if valid
1402
- */
1403
- function validateToken(token, gracePeriodMs = AUTH_CONSTANTS.TOKEN_GRACE_PERIOD_MS) {
1404
- if (!token || token.trim() === "") return {
1405
- isValid: false,
1406
- error: "Token is empty or not provided"
1407
- };
1408
- const payload = decodeToken(token);
1409
- if (!payload) return {
1410
- isValid: false,
1411
- error: "Token has invalid format"
1412
- };
1413
- if (isTokenExpired(token, gracePeriodMs)) return {
1414
- isValid: false,
1415
- payload,
1416
- error: "Token has expired"
1417
- };
1418
- return {
1419
- isValid: true,
1420
- payload
1421
- };
1422
- }
1423
- /**
1424
- * Type guard to check if a validation result is valid.
1425
- * Enables TypeScript narrowing of the result type.
1426
- *
1427
- * @param result - The validation result to check
1428
- * @returns true if the token is valid (narrows payload to non-optional)
1429
- */
1430
- function isValidToken(result) {
1431
- return result.isValid === true;
1432
- }
1433
- /**
1434
- * Get the expiration time of a token as a Date.
1435
- *
1436
- * @param token - The JWT token string
1437
- * @returns The expiration Date, or null if token has no expiration or is invalid
1438
- */
1439
- function getTokenExpiration(token) {
1440
- try {
1441
- const decoded = decodeJwt(token);
1442
- if (!decoded.exp) return null;
1443
- return /* @__PURE__ */ new Date(decoded.exp * 1e3);
1444
- } catch {
1445
- return null;
1446
- }
1447
- }
1448
- /**
1449
- * Get the time remaining until token expiration in milliseconds.
1450
- *
1451
- * @param token - The JWT token string
1452
- * @returns Milliseconds until expiration, or 0 if expired/invalid, or Infinity if no expiration
1453
- */
1454
- function getTokenTimeRemaining(token) {
1455
- try {
1456
- const decoded = decodeJwt(token);
1457
- if (!decoded.exp) return Infinity;
1458
- const remaining = decoded.exp * 1e3 - Date.now();
1459
- return Math.max(0, remaining);
1460
- } catch {
1461
- return 0;
1462
- }
1463
- }
1464
1145
  //#endregion
1465
1146
  //#region ../../platform/auth/src/token-storage.ts
1466
1147
  /**
@@ -1470,33 +1151,6 @@ function getTokenTimeRemaining(token) {
1470
1151
  * cookies and localStorage.
1471
1152
  */
1472
1153
  /**
1473
- * Parse cookies from document.cookie string into an object.
1474
- */
1475
- function parseCookies() {
1476
- if (!isBrowser()) return {};
1477
- const cookies = {};
1478
- const cookieString = document.cookie;
1479
- if (!cookieString) return cookies;
1480
- cookieString.split(";").forEach((cookie) => {
1481
- const [name, ...valueParts] = cookie.trim().split("=");
1482
- if (name) cookies[name] = decodeURIComponent(valueParts.join("="));
1483
- });
1484
- return cookies;
1485
- }
1486
- /**
1487
- * Set a cookie with the given options.
1488
- */
1489
- function setCookie(name, value, options = {}) {
1490
- if (!isBrowser()) return;
1491
- const { maxAge = AUTH_CONSTANTS.COOKIE_MAX_AGE, path = "/", sameSite = "lax", secure = window.location.protocol === "https:" } = options;
1492
- let cookieString = `${name}=${encodeURIComponent(value)}`;
1493
- cookieString += `; path=${path}`;
1494
- cookieString += `; max-age=${maxAge}`;
1495
- cookieString += `; samesite=${sameSite}`;
1496
- if (secure) cookieString += "; secure";
1497
- document.cookie = cookieString;
1498
- }
1499
- /**
1500
1154
  * Delete a cookie by setting its max-age to 0.
1501
1155
  */
1502
1156
  function deleteCookie(name, path = "/") {
@@ -1504,53 +1158,6 @@ function deleteCookie(name, path = "/") {
1504
1158
  document.cookie = `${name}=; path=${path}; max-age=0`;
1505
1159
  }
1506
1160
  /**
1507
- * Get the stored auth token.
1508
- * Checks cookie first, then falls back to localStorage.
1509
- *
1510
- * @param config - Optional auth config for custom cookie key
1511
- * @returns The stored token or null if not found
1512
- */
1513
- function getStoredToken(config) {
1514
- if (!isBrowser()) return null;
1515
- const cookieKey = config?.cookieKey ?? STORAGE_KEYS.AUTH_COOKIE;
1516
- const localStorageKey = STORAGE_KEYS.USER_TOKEN;
1517
- const cookieToken = parseCookies()[cookieKey];
1518
- if (cookieToken) return cookieToken;
1519
- try {
1520
- return localStorage.getItem(localStorageKey);
1521
- } catch {
1522
- return null;
1523
- }
1524
- }
1525
- /**
1526
- * Store an auth token in both cookie and localStorage.
1527
- * Using both provides redundancy and compatibility with different auth flows.
1528
- *
1529
- * @param token - The JWT token to store
1530
- * @param config - Optional auth config for custom storage options
1531
- */
1532
- function storeToken(token, config) {
1533
- if (!isBrowser()) return;
1534
- const cookieKey = config?.cookieKey ?? STORAGE_KEYS.AUTH_COOKIE;
1535
- const maxAge = config?.cookieMaxAge ?? AUTH_CONSTANTS.COOKIE_MAX_AGE;
1536
- try {
1537
- const sameSite = window.self !== window.top ? "none" : "lax";
1538
- setCookie(cookieKey, token, {
1539
- maxAge,
1540
- path: "/",
1541
- sameSite,
1542
- secure: sameSite === "none" || window.location.protocol === "https:"
1543
- });
1544
- } catch (error) {
1545
- console.warn("[FluidAuth] Failed to store token in cookie:", error);
1546
- }
1547
- try {
1548
- localStorage.setItem(STORAGE_KEYS.USER_TOKEN, token);
1549
- } catch (error) {
1550
- console.warn("[FluidAuth] Failed to store token in localStorage:", error);
1551
- }
1552
- }
1553
- /**
1554
1161
  * Clear all stored auth tokens from cookies and localStorage.
1555
1162
  *
1556
1163
  * @param config - Optional auth config for custom cookie key
@@ -1566,15 +1173,6 @@ function clearTokens(config) {
1566
1173
  localStorage.removeItem(STORAGE_KEYS.COMPANY_TOKEN);
1567
1174
  } catch {}
1568
1175
  }
1569
- /**
1570
- * Check if any auth token is stored.
1571
- *
1572
- * @param config - Optional auth config
1573
- * @returns true if a token is stored, false otherwise
1574
- */
1575
- function hasStoredToken(config) {
1576
- return getStoredToken(config) !== null;
1577
- }
1578
1176
  //#endregion
1579
1177
  //#region ../../platform/auth/src/url-token.ts
1580
1178
  /**
@@ -1590,35 +1188,6 @@ function hasStoredToken(config) {
1590
1188
  * starter template prevents the token from leaking in referrer headers.
1591
1189
  */
1592
1190
  /**
1593
- * Extract the auth token from the URL query parameters.
1594
- *
1595
- * @param tokenKey - The URL parameter name (default: "fluidUserToken")
1596
- * @returns The token value or null if not present
1597
- */
1598
- function extractTokenFromUrl(tokenKey = URL_PARAMS.USER_TOKEN) {
1599
- if (!isBrowser()) return null;
1600
- try {
1601
- return new URLSearchParams(window.location.search).get(tokenKey);
1602
- } catch {
1603
- return null;
1604
- }
1605
- }
1606
- /**
1607
- * Extract the company token from the URL query parameters.
1608
- * This is a legacy parameter that may still be used in some flows.
1609
- *
1610
- * @param tokenKey - The URL parameter name (default: "fluidCompanyToken")
1611
- * @returns The token value or null if not present
1612
- */
1613
- function extractCompanyTokenFromUrl(tokenKey = URL_PARAMS.COMPANY_TOKEN) {
1614
- if (!isBrowser()) return null;
1615
- try {
1616
- return new URLSearchParams(window.location.search).get(tokenKey);
1617
- } catch {
1618
- return null;
1619
- }
1620
- }
1621
- /**
1622
1191
  * Remove the auth token from the URL without reloading the page.
1623
1192
  * This prevents the token from being accidentally shared via URL copy/paste
1624
1193
  * or appearing in browser history.
@@ -1640,45 +1209,6 @@ function cleanTokenFromUrl(tokenKey = URL_PARAMS.USER_TOKEN) {
1640
1209
  console.warn("[FluidAuth] Failed to clean token from URL:", error);
1641
1210
  }
1642
1211
  }
1643
- /**
1644
- * Check if the URL contains an auth token parameter.
1645
- *
1646
- * @param tokenKey - The URL parameter name (default: "fluidUserToken")
1647
- * @returns true if the URL contains the token parameter
1648
- */
1649
- function hasTokenInUrl(tokenKey = URL_PARAMS.USER_TOKEN) {
1650
- if (!isBrowser()) return false;
1651
- try {
1652
- return new URLSearchParams(window.location.search).has(tokenKey);
1653
- } catch {
1654
- return false;
1655
- }
1656
- }
1657
- /**
1658
- * Extract all auth-related tokens from the URL at once.
1659
- *
1660
- * @param userTokenKey - The URL parameter name for user token
1661
- * @param companyTokenKey - The URL parameter name for company token
1662
- * @returns Object with both token values (or null if not present)
1663
- */
1664
- function extractAllTokensFromUrl(userTokenKey = URL_PARAMS.USER_TOKEN, companyTokenKey = URL_PARAMS.COMPANY_TOKEN) {
1665
- if (!isBrowser()) return {
1666
- userToken: null,
1667
- companyToken: null
1668
- };
1669
- try {
1670
- const searchParams = new URLSearchParams(window.location.search);
1671
- return {
1672
- userToken: searchParams.get(userTokenKey),
1673
- companyToken: searchParams.get(companyTokenKey)
1674
- };
1675
- } catch {
1676
- return {
1677
- userToken: null,
1678
- companyToken: null
1679
- };
1680
- }
1681
- }
1682
1212
  z.object({
1683
1213
  id: z.number(),
1684
1214
  name: z.string(),
@@ -3083,13 +2613,11 @@ function authReducer(state, action) {
3083
2613
  switch (action.type) {
3084
2614
  case "SET_AUTH": return {
3085
2615
  isLoading: false,
3086
- token: null,
3087
2616
  user: action.user,
3088
2617
  error: action.error
3089
2618
  };
3090
2619
  case "CLEAR_AUTH": return {
3091
2620
  ...state,
3092
- token: null,
3093
2621
  user: null,
3094
2622
  error: null
3095
2623
  };
@@ -3101,7 +2629,6 @@ function authReducer(state, action) {
3101
2629
  }
3102
2630
  const initialAuthState = {
3103
2631
  isLoading: true,
3104
- token: null,
3105
2632
  user: null,
3106
2633
  error: null
3107
2634
  };
@@ -3134,7 +2661,7 @@ function FluidAuthProvider({ children, config }) {
3134
2661
  const configRef = useRef(config);
3135
2662
  configRef.current = config;
3136
2663
  const [state, dispatch] = useReducer(authReducer, initialAuthState);
3137
- const { isLoading, token, user, error } = state;
2664
+ const { isLoading, user, error } = state;
3138
2665
  useEffect(() => {
3139
2666
  const initializeAuth = async () => {
3140
2667
  const handleUnauthenticated = () => {
@@ -3181,11 +2708,9 @@ function FluidAuthProvider({ children, config }) {
3181
2708
  isAuthenticated: user !== null,
3182
2709
  isLoading,
3183
2710
  user,
3184
- token,
3185
2711
  clearAuth,
3186
2712
  error
3187
2713
  }), [
3188
- token,
3189
2714
  isLoading,
3190
2715
  user,
3191
2716
  clearAuth,
@@ -3393,21 +2918,20 @@ function FluidProvider({ config, children, queryClient, initialTheme, themeConta
3393
2918
  */
3394
2919
  function CustomerIdEnricher({ baseUrl, getApiHeaders, variables, registry, themeProviderProps, onAuthError, children }) {
3395
2920
  const authContext = useFluidAuthOptional();
3396
- const token = authContext?.token ?? "";
2921
+ const isAuthenticated = authContext?.isAuthenticated ?? false;
3397
2922
  const userId = authContext?.user?.id;
3398
2923
  const onAuthErrorRef = useRef(onAuthError);
3399
2924
  onAuthErrorRef.current = onAuthError;
3400
2925
  const fluidPayApi = useMemo(() => {
3401
2926
  return createFluidPayApi(createFetchClient({
3402
2927
  baseUrl: baseUrl.endsWith("/api") ? baseUrl : `${baseUrl.replace(/\/+$/, "")}/api`,
3403
- getAuthToken: () => token,
3404
2928
  onAuthError: () => onAuthErrorRef.current?.()
3405
2929
  }));
3406
- }, [baseUrl, token]);
2930
+ }, [baseUrl]);
3407
2931
  const { data: customerData } = useQuery({
3408
2932
  queryKey: ["fluidPayAccount", userId],
3409
- queryFn: () => fluidPayApi.customers.fetchAccount(token),
3410
- enabled: !!token
2933
+ queryFn: () => fluidPayApi.customers.fetchAccount(""),
2934
+ enabled: isAuthenticated
3411
2935
  });
3412
2936
  const customerId = customerData?.customer?.id;
3413
2937
  return /* @__PURE__ */ jsx(FluidPayCoreProvider, {
@@ -3443,6 +2967,6 @@ function useFluidContext() {
3443
2967
  return context;
3444
2968
  }
3445
2969
  //#endregion
3446
- export { extractTokenFromUrl as $, DEFAULT_FONT_SIZES as A, mergeDarkOverrides as B, buildThemeDefinition as C, serialiseTheme as D, deserialiseTheme as E, getDefaultThemeDefinition as F, RADIUS_KEYS as G, resolveTheme as H, generateThemeCSS as I, DEFAULT_AUTH_URL as J, SEMANTIC_COLOR_NAMES as K, deriveDarkVariant as L, DEFAULT_SPACING as M, DEFAULT_THEME_ID as N, DEFAULT_COLORS as O, DEFAULT_THEME_NAME as P, extractCompanyTokenFromUrl as Q, generateShades as R, removeTheme as S, createFetchClient as St, transformThemes as T, FONT_FAMILY_KEYS as U, parseColor as V, FONT_SIZE_KEYS as W, cleanTokenFromUrl as X, createDefaultAuthRedirect as Y, extractAllTokensFromUrl as Z, toNavigationItem as _, createPersister as _t, createScreen as a, decodeToken as at, applyTheme as b, useFluidPayApi as bt, FluidAuthProvider as c, isTokenExpired as ct, useThemeContext as d, AUTH_CONSTANTS as dt, hasTokenInUrl as et, ApiError as f, STORAGE_KEYS as ft, transformManifestToRepAppData as g, useFluidOsApiOptional as gt, toRawManifest as h, isUserType as ht, widgetPropertySchemas as i, storeToken as it, DEFAULT_RADII as j, DEFAULT_FONT_FAMILIES as k, useFluidAuthContext as l, isValidToken as lt, isApiError as m, USER_TYPES as mt, useFluidContext as n, getStoredToken as nt, createWidgetFromShareable as o, getTokenExpiration as ot, createFluidClient as p, URL_PARAMS as pt, SHADE_STEPS as q, DEFAULT_SDK_WIDGET_REGISTRY as r, hasStoredToken as rt, createWidgetRegistry as s, getTokenTimeRemaining as st, FluidProvider as t, clearTokens as tt, FluidThemeProvider as u, validateToken as ut, normalizeComponentTree as v, deleteDatabase as vt, getActiveThemeId as w, removeAllThemes as x, ApiError$1 as xt, toScreenDefinition as y, useCountryStates as yt, getForegroundColor as z };
2970
+ export { USER_TYPES as $, DEFAULT_FONT_SIZES as A, mergeDarkOverrides as B, buildThemeDefinition as C, serialiseTheme as D, deserialiseTheme as E, getDefaultThemeDefinition as F, RADIUS_KEYS as G, resolveTheme as H, generateThemeCSS as I, DEFAULT_AUTH_URL as J, SEMANTIC_COLOR_NAMES as K, deriveDarkVariant as L, DEFAULT_SPACING as M, DEFAULT_THEME_ID as N, DEFAULT_COLORS as O, DEFAULT_THEME_NAME as P, AUTH_CONSTANTS as Q, generateShades as R, removeTheme as S, transformThemes as T, FONT_FAMILY_KEYS as U, parseColor as V, FONT_SIZE_KEYS as W, cleanTokenFromUrl as X, createDefaultAuthRedirect as Y, clearTokens as Z, toNavigationItem as _, createScreen as a, useFluidPayApi as at, applyTheme as b, FluidAuthProvider as c, useThemeContext as d, isUserType as et, ApiError as f, transformManifestToRepAppData as g, toRawManifest as h, widgetPropertySchemas as i, useCountryStates as it, DEFAULT_RADII as j, DEFAULT_FONT_FAMILIES as k, useFluidAuthContext as l, isApiError as m, useFluidContext as n, createPersister as nt, createWidgetFromShareable as o, ApiError$1 as ot, createFluidClient as p, SHADE_STEPS as q, DEFAULT_SDK_WIDGET_REGISTRY as r, deleteDatabase as rt, createWidgetRegistry as s, createFetchClient as st, FluidProvider as t, useFluidOsApiOptional as tt, FluidThemeProvider as u, normalizeComponentTree as v, getActiveThemeId as w, removeAllThemes as x, toScreenDefinition as y, getForegroundColor as z };
3447
2971
 
3448
- //# sourceMappingURL=FluidProvider-B59bzF__.mjs.map
2972
+ //# sourceMappingURL=FluidProvider-dTwaHRzI.mjs.map