@forgerock/login-widget 1.2.0-beta.4 → 1.2.0-beta.5

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.
package/index.d.ts CHANGED
@@ -1717,55 +1717,55 @@ declare const partialConfigSchema: ZodObject<{
1717
1717
  serverConfig: ZodOptional<ZodObject<{
1718
1718
  baseUrl: ZodString;
1719
1719
  paths: ZodOptional<ZodObject<{
1720
- authenticate: ZodString;
1721
- authorize: ZodString;
1722
- accessToken: ZodString;
1723
- endSession: ZodString;
1724
- userInfo: ZodString;
1725
- revoke: ZodString;
1726
- sessions: ZodString;
1727
- }, "strip", ZodTypeAny, {
1728
- authenticate: string;
1729
- authorize: string;
1730
- accessToken: string;
1731
- endSession: string;
1732
- userInfo: string;
1733
- revoke: string;
1734
- sessions: string;
1720
+ authenticate: ZodOptional<ZodString>;
1721
+ authorize: ZodOptional<ZodString>;
1722
+ accessToken: ZodOptional<ZodString>;
1723
+ endSession: ZodOptional<ZodString>;
1724
+ userInfo: ZodOptional<ZodString>;
1725
+ revoke: ZodOptional<ZodString>;
1726
+ sessions: ZodOptional<ZodString>;
1727
+ }, "strict", ZodTypeAny, {
1728
+ authenticate?: string | undefined;
1729
+ authorize?: string | undefined;
1730
+ accessToken?: string | undefined;
1731
+ endSession?: string | undefined;
1732
+ userInfo?: string | undefined;
1733
+ revoke?: string | undefined;
1734
+ sessions?: string | undefined;
1735
1735
  }, {
1736
- authenticate: string;
1737
- authorize: string;
1738
- accessToken: string;
1739
- endSession: string;
1740
- userInfo: string;
1741
- revoke: string;
1742
- sessions: string;
1736
+ authenticate?: string | undefined;
1737
+ authorize?: string | undefined;
1738
+ accessToken?: string | undefined;
1739
+ endSession?: string | undefined;
1740
+ userInfo?: string | undefined;
1741
+ revoke?: string | undefined;
1742
+ sessions?: string | undefined;
1743
1743
  }>>;
1744
- timeout: ZodNumber;
1745
- }, "strip", ZodTypeAny, {
1746
- timeout: number;
1744
+ timeout: ZodOptional<ZodNumber>;
1745
+ }, "strict", ZodTypeAny, {
1747
1746
  baseUrl: string;
1748
1747
  paths?: {
1749
- authenticate: string;
1750
- authorize: string;
1751
- accessToken: string;
1752
- endSession: string;
1753
- userInfo: string;
1754
- revoke: string;
1755
- sessions: string;
1748
+ authenticate?: string | undefined;
1749
+ authorize?: string | undefined;
1750
+ accessToken?: string | undefined;
1751
+ endSession?: string | undefined;
1752
+ userInfo?: string | undefined;
1753
+ revoke?: string | undefined;
1754
+ sessions?: string | undefined;
1756
1755
  } | undefined;
1756
+ timeout?: number | undefined;
1757
1757
  }, {
1758
- timeout: number;
1759
1758
  baseUrl: string;
1760
1759
  paths?: {
1761
- authenticate: string;
1762
- authorize: string;
1763
- accessToken: string;
1764
- endSession: string;
1765
- userInfo: string;
1766
- revoke: string;
1767
- sessions: string;
1760
+ authenticate?: string | undefined;
1761
+ authorize?: string | undefined;
1762
+ accessToken?: string | undefined;
1763
+ endSession?: string | undefined;
1764
+ userInfo?: string | undefined;
1765
+ revoke?: string | undefined;
1766
+ sessions?: string | undefined;
1768
1767
  } | undefined;
1768
+ timeout?: number | undefined;
1769
1769
  }>>;
1770
1770
  support: ZodOptional<ZodOptional<ZodUnion<[ZodLiteral<"legacy">, ZodLiteral<"modern">]>>>;
1771
1771
  tokenStore: ZodOptional<ZodOptional<ZodUnion<[ZodObject<{
@@ -1787,7 +1787,7 @@ declare const partialConfigSchema: ZodObject<{
1787
1787
  }>>>;
1788
1788
  set: ZodFunction<ZodTuple<[ZodString], ZodUnknown>, ZodPromise<ZodVoid>>;
1789
1789
  remove: ZodFunction<ZodTuple<[ZodString], ZodUnknown>, ZodPromise<ZodVoid>>;
1790
- }, "strip", ZodTypeAny, {
1790
+ }, "strict", ZodTypeAny, {
1791
1791
  set: (args_0: string, ...args_1: unknown[]) => Promise<void>;
1792
1792
  remove: (args_0: string, ...args_1: unknown[]) => Promise<void>;
1793
1793
  get: (args_0: string, ...args_1: unknown[]) => Promise<{
@@ -1828,17 +1828,17 @@ declare const partialConfigSchema: ZodObject<{
1828
1828
  redirectUri?: string | undefined;
1829
1829
  scope?: string | undefined;
1830
1830
  serverConfig?: {
1831
- timeout: number;
1832
1831
  baseUrl: string;
1833
1832
  paths?: {
1834
- authenticate: string;
1835
- authorize: string;
1836
- accessToken: string;
1837
- endSession: string;
1838
- userInfo: string;
1839
- revoke: string;
1840
- sessions: string;
1833
+ authenticate?: string | undefined;
1834
+ authorize?: string | undefined;
1835
+ accessToken?: string | undefined;
1836
+ endSession?: string | undefined;
1837
+ userInfo?: string | undefined;
1838
+ revoke?: string | undefined;
1839
+ sessions?: string | undefined;
1841
1840
  } | undefined;
1841
+ timeout?: number | undefined;
1842
1842
  } | undefined;
1843
1843
  support?: "legacy" | "modern" | undefined;
1844
1844
  tokenStore?: "localStorage" | "sessionStorage" | {
@@ -1873,17 +1873,17 @@ declare const partialConfigSchema: ZodObject<{
1873
1873
  redirectUri?: string | undefined;
1874
1874
  scope?: string | undefined;
1875
1875
  serverConfig?: {
1876
- timeout: number;
1877
1876
  baseUrl: string;
1878
1877
  paths?: {
1879
- authenticate: string;
1880
- authorize: string;
1881
- accessToken: string;
1882
- endSession: string;
1883
- userInfo: string;
1884
- revoke: string;
1885
- sessions: string;
1878
+ authenticate?: string | undefined;
1879
+ authorize?: string | undefined;
1880
+ accessToken?: string | undefined;
1881
+ endSession?: string | undefined;
1882
+ userInfo?: string | undefined;
1883
+ revoke?: string | undefined;
1884
+ sessions?: string | undefined;
1886
1885
  } | undefined;
1886
+ timeout?: number | undefined;
1887
1887
  } | undefined;
1888
1888
  support?: "legacy" | "modern" | undefined;
1889
1889
  tokenStore?: "localStorage" | "sessionStorage" | {
@@ -2270,14 +2270,14 @@ declare const partialStyleSchema: ZodObject<{
2270
2270
  }>>>;
2271
2271
  sections: ZodOptional<ZodOptional<ZodObject<{
2272
2272
  header: ZodOptional<ZodBoolean>;
2273
- }, "strip", ZodTypeAny, {
2273
+ }, "strict", ZodTypeAny, {
2274
2274
  header?: boolean | undefined;
2275
2275
  }, {
2276
2276
  header?: boolean | undefined;
2277
2277
  }>>>;
2278
2278
  stage: ZodOptional<ZodOptional<ZodObject<{
2279
2279
  icon: ZodOptional<ZodBoolean>;
2280
- }, "strip", ZodTypeAny, {
2280
+ }, "strict", ZodTypeAny, {
2281
2281
  icon?: boolean | undefined;
2282
2282
  }, {
2283
2283
  icon?: boolean | undefined;
package/index.js CHANGED
@@ -9085,7 +9085,8 @@ const configSchema = z
9085
9085
  realmPath: z.string(),
9086
9086
  redirectUri: z.string().optional(),
9087
9087
  scope: z.string().optional(),
9088
- serverConfig: z.object({
9088
+ serverConfig: z
9089
+ .object({
9089
9090
  baseUrl: z
9090
9091
  .string({
9091
9092
  invalid_type_error: '`serverConfig.baseUrl` is a required URL string (this is generated by the Zod library).',
@@ -9096,25 +9097,28 @@ const configSchema = z
9096
9097
  }),
9097
9098
  paths: z
9098
9099
  .object({
9099
- authenticate: z.string(),
9100
- authorize: z.string(),
9101
- accessToken: z.string(),
9102
- endSession: z.string(),
9103
- userInfo: z.string(),
9104
- revoke: z.string(),
9105
- sessions: z.string(),
9100
+ authenticate: z.string().optional(),
9101
+ authorize: z.string().optional(),
9102
+ accessToken: z.string().optional(),
9103
+ endSession: z.string().optional(),
9104
+ userInfo: z.string().optional(),
9105
+ revoke: z.string().optional(),
9106
+ sessions: z.string().optional(),
9106
9107
  })
9108
+ .strict()
9107
9109
  .optional(),
9108
- // TODO: timeout should be optional; fix in SDK
9109
- timeout: z.number({
9110
+ timeout: z
9111
+ .number({
9110
9112
  invalid_type_error: '`serverConfig.timeout` is a required number and in milliseconds (this is generated by the Zod library).',
9111
- required_error: 'Setting the `serverConfig.timeout` is required (this is generated by the Zod library).',
9112
- }),
9113
- }),
9113
+ })
9114
+ .optional(),
9115
+ })
9116
+ .strict(),
9114
9117
  support: z.union([z.literal('legacy'), z.literal('modern')]).optional(),
9115
9118
  tokenStore: z
9116
9119
  .union([
9117
- z.object({
9120
+ z
9121
+ .object({
9118
9122
  get: z
9119
9123
  .function()
9120
9124
  .args(z.string())
@@ -9126,7 +9130,8 @@ const configSchema = z
9126
9130
  }))),
9127
9131
  set: z.function().args(z.string()).returns(z.promise(z.void())),
9128
9132
  remove: z.function().args(z.string()).returns(z.promise(z.void())),
9129
- }),
9133
+ })
9134
+ .strict(),
9130
9135
  z.literal('sessionStorage'),
9131
9136
  z.literal('localStorage'),
9132
9137
  ])
@@ -12068,7 +12073,9 @@ function initialize$3(customLinks) {
12068
12073
  return linksStore;
12069
12074
  }
12070
12075
 
12076
+ const authorizationTimedOut = 'Authorization timed out';
12071
12077
  const interactionNeeded = 'The request requires some interaction that is not allowed.';
12078
+ const timeoutErrorMessage = 'Timeouts are likely an issue with OAuth client misconfiguration. If you are getting a 4xx error in the network tab, copy the full `/authorize` URL and paste it directly into your browsers URL field to directly visit the page. The error should be displayed on the page.';
12072
12079
  const sessionCookieConsentMessage = `The user either doesn't have a valid session, the cookie is not being sent due to third-party cookies being disabled, or the user is needing to provide consent as the OAuth client setting does not have "implied consent" enabled.`;
12073
12080
  const oauthStore = writable({
12074
12081
  completed: false,
@@ -12077,6 +12084,16 @@ const oauthStore = writable({
12077
12084
  successful: false,
12078
12085
  response: null,
12079
12086
  });
12087
+ function getTroubleshootingMessage(message) {
12088
+ switch (message) {
12089
+ case interactionNeeded:
12090
+ return sessionCookieConsentMessage;
12091
+ case authorizationTimedOut:
12092
+ return timeoutErrorMessage;
12093
+ default:
12094
+ return '';
12095
+ }
12096
+ }
12080
12097
  /**
12081
12098
  * @function initialize - Initializes the OAuth store with a get function and a reset function
12082
12099
  * @param {object} initOptions - The options to pass to the TokenManager.getTokens function
@@ -12117,7 +12134,7 @@ function initialize$2(initOptions) {
12117
12134
  completed: true,
12118
12135
  error: {
12119
12136
  message: err.message,
12120
- troubleshoot: err.message === interactionNeeded ? sessionCookieConsentMessage : '',
12137
+ troubleshoot: getTroubleshootingMessage(err.message),
12121
12138
  },
12122
12139
  loading: false,
12123
12140
  successful: false,
@@ -12243,11 +12260,13 @@ const styleSchema = z
12243
12260
  .object({
12244
12261
  header: z.boolean().optional(),
12245
12262
  })
12263
+ .strict()
12246
12264
  .optional(),
12247
12265
  stage: z
12248
12266
  .object({
12249
12267
  icon: z.boolean().optional(),
12250
12268
  })
12269
+ .strict()
12251
12270
  .optional(),
12252
12271
  })
12253
12272
  .strict();