@thunderid/tanstack-router 0.0.1
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/LICENSE +201 -0
- package/dist/cjs/index.js +316 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/components/CallbackRoute.d.ts +52 -0
- package/dist/components/CallbackRoute.d.ts.map +1 -0
- package/dist/components/ProtectedRoute.d.ts +78 -0
- package/dist/components/ProtectedRoute.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +317 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
+
key = keys[i];
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
value: mod,
|
|
23
|
+
enumerable: true
|
|
24
|
+
}) : target, mod));
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
let __tanstack_react_router = require("@tanstack/react-router");
|
|
28
|
+
__tanstack_react_router = __toESM(__tanstack_react_router);
|
|
29
|
+
let __thunderid_react = require("@thunderid/react");
|
|
30
|
+
__thunderid_react = __toESM(__thunderid_react);
|
|
31
|
+
|
|
32
|
+
//#region ../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js
|
|
33
|
+
var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js": ((exports) => {
|
|
34
|
+
(function() {
|
|
35
|
+
function getComponentNameFromType(type) {
|
|
36
|
+
if (null == type) return null;
|
|
37
|
+
if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
38
|
+
if ("string" === typeof type) return type;
|
|
39
|
+
switch (type) {
|
|
40
|
+
case REACT_FRAGMENT_TYPE: return "Fragment";
|
|
41
|
+
case REACT_PROFILER_TYPE: return "Profiler";
|
|
42
|
+
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
43
|
+
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
44
|
+
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
45
|
+
case REACT_ACTIVITY_TYPE: return "Activity";
|
|
46
|
+
}
|
|
47
|
+
if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
48
|
+
case REACT_PORTAL_TYPE: return "Portal";
|
|
49
|
+
case REACT_CONTEXT_TYPE: return type.displayName || "Context";
|
|
50
|
+
case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer";
|
|
51
|
+
case REACT_FORWARD_REF_TYPE:
|
|
52
|
+
var innerType = type.render;
|
|
53
|
+
type = type.displayName;
|
|
54
|
+
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
55
|
+
return type;
|
|
56
|
+
case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
57
|
+
case REACT_LAZY_TYPE:
|
|
58
|
+
innerType = type._payload;
|
|
59
|
+
type = type._init;
|
|
60
|
+
try {
|
|
61
|
+
return getComponentNameFromType(type(innerType));
|
|
62
|
+
} catch (x) {}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
function testStringCoercion(value) {
|
|
67
|
+
return "" + value;
|
|
68
|
+
}
|
|
69
|
+
function checkKeyStringCoercion(value) {
|
|
70
|
+
try {
|
|
71
|
+
testStringCoercion(value);
|
|
72
|
+
var JSCompiler_inline_result = !1;
|
|
73
|
+
} catch (e) {
|
|
74
|
+
JSCompiler_inline_result = !0;
|
|
75
|
+
}
|
|
76
|
+
if (JSCompiler_inline_result) {
|
|
77
|
+
JSCompiler_inline_result = console;
|
|
78
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
79
|
+
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
80
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
81
|
+
return testStringCoercion(value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getTaskName(type) {
|
|
85
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
86
|
+
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
87
|
+
try {
|
|
88
|
+
var name = getComponentNameFromType(type);
|
|
89
|
+
return name ? "<" + name + ">" : "<...>";
|
|
90
|
+
} catch (x) {
|
|
91
|
+
return "<...>";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function getOwner() {
|
|
95
|
+
var dispatcher = ReactSharedInternals.A;
|
|
96
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
97
|
+
}
|
|
98
|
+
function UnknownOwner() {
|
|
99
|
+
return Error("react-stack-top-frame");
|
|
100
|
+
}
|
|
101
|
+
function hasValidKey(config) {
|
|
102
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
103
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
104
|
+
if (getter && getter.isReactWarning) return !1;
|
|
105
|
+
}
|
|
106
|
+
return void 0 !== config.key;
|
|
107
|
+
}
|
|
108
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
109
|
+
function warnAboutAccessingKey() {
|
|
110
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
111
|
+
}
|
|
112
|
+
warnAboutAccessingKey.isReactWarning = !0;
|
|
113
|
+
Object.defineProperty(props, "key", {
|
|
114
|
+
get: warnAboutAccessingKey,
|
|
115
|
+
configurable: !0
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
119
|
+
var componentName = getComponentNameFromType(this.type);
|
|
120
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
121
|
+
componentName = this.props.ref;
|
|
122
|
+
return void 0 !== componentName ? componentName : null;
|
|
123
|
+
}
|
|
124
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
125
|
+
var refProp = props.ref;
|
|
126
|
+
type = {
|
|
127
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
128
|
+
type,
|
|
129
|
+
key,
|
|
130
|
+
props,
|
|
131
|
+
_owner: owner
|
|
132
|
+
};
|
|
133
|
+
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
134
|
+
enumerable: !1,
|
|
135
|
+
get: elementRefGetterWithDeprecationWarning
|
|
136
|
+
}) : Object.defineProperty(type, "ref", {
|
|
137
|
+
enumerable: !1,
|
|
138
|
+
value: null
|
|
139
|
+
});
|
|
140
|
+
type._store = {};
|
|
141
|
+
Object.defineProperty(type._store, "validated", {
|
|
142
|
+
configurable: !1,
|
|
143
|
+
enumerable: !1,
|
|
144
|
+
writable: !0,
|
|
145
|
+
value: 0
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
148
|
+
configurable: !1,
|
|
149
|
+
enumerable: !1,
|
|
150
|
+
writable: !0,
|
|
151
|
+
value: null
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(type, "_debugStack", {
|
|
154
|
+
configurable: !1,
|
|
155
|
+
enumerable: !1,
|
|
156
|
+
writable: !0,
|
|
157
|
+
value: debugStack
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(type, "_debugTask", {
|
|
160
|
+
configurable: !1,
|
|
161
|
+
enumerable: !1,
|
|
162
|
+
writable: !0,
|
|
163
|
+
value: debugTask
|
|
164
|
+
});
|
|
165
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
166
|
+
return type;
|
|
167
|
+
}
|
|
168
|
+
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
169
|
+
var children = config.children;
|
|
170
|
+
if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) {
|
|
171
|
+
for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++) validateChildKeys(children[isStaticChildren]);
|
|
172
|
+
Object.freeze && Object.freeze(children);
|
|
173
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
174
|
+
else validateChildKeys(children);
|
|
175
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
176
|
+
children = getComponentNameFromType(type);
|
|
177
|
+
var keys = Object.keys(config).filter(function(k) {
|
|
178
|
+
return "key" !== k;
|
|
179
|
+
});
|
|
180
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
181
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0);
|
|
182
|
+
}
|
|
183
|
+
children = null;
|
|
184
|
+
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
185
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
186
|
+
if ("key" in config) {
|
|
187
|
+
maybeKey = {};
|
|
188
|
+
for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
|
|
189
|
+
} else maybeKey = config;
|
|
190
|
+
children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
191
|
+
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
192
|
+
}
|
|
193
|
+
function validateChildKeys(node) {
|
|
194
|
+
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
195
|
+
}
|
|
196
|
+
function isValidElement(object) {
|
|
197
|
+
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
198
|
+
}
|
|
199
|
+
var React = require("react"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
200
|
+
return null;
|
|
201
|
+
};
|
|
202
|
+
React = { react_stack_bottom_frame: function(callStackForError) {
|
|
203
|
+
return callStackForError();
|
|
204
|
+
} };
|
|
205
|
+
var specialPropKeyWarningShown;
|
|
206
|
+
var didWarnAboutElementRef = {};
|
|
207
|
+
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
208
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
209
|
+
var didWarnAboutKeySpread = {};
|
|
210
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
211
|
+
exports.jsx = function(type, config, maybeKey) {
|
|
212
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
213
|
+
return jsxDEVImpl(type, config, maybeKey, !1, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
214
|
+
};
|
|
215
|
+
exports.jsxs = function(type, config, maybeKey) {
|
|
216
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
217
|
+
return jsxDEVImpl(type, config, maybeKey, !0, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
218
|
+
};
|
|
219
|
+
})();
|
|
220
|
+
}) });
|
|
221
|
+
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region ../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js
|
|
224
|
+
var require_jsx_runtime = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js": ((exports, module) => {
|
|
225
|
+
module.exports = require_react_jsx_runtime_development();
|
|
226
|
+
}) });
|
|
227
|
+
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/components/ProtectedRoute.tsx
|
|
230
|
+
var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
|
|
231
|
+
/**
|
|
232
|
+
* A protected route component that requires authentication to access.
|
|
233
|
+
*
|
|
234
|
+
* This component should be used as the component prop of a TanStack Router route.
|
|
235
|
+
* It checks authentication status and either renders the protected content,
|
|
236
|
+
* shows a loading state, redirects, or shows a fallback.
|
|
237
|
+
*
|
|
238
|
+
* Either a `redirectTo` prop or a `fallback` prop must be provided to handle
|
|
239
|
+
* unauthenticated users.
|
|
240
|
+
*
|
|
241
|
+
* @example Basic usage with redirect
|
|
242
|
+
* ```tsx
|
|
243
|
+
* const dashboardRoute = createRouteConfig({
|
|
244
|
+
* path: '/dashboard',
|
|
245
|
+
* component: () => (
|
|
246
|
+
* <ProtectedRoute redirectTo="/signin">
|
|
247
|
+
* <Dashboard />
|
|
248
|
+
* </ProtectedRoute>
|
|
249
|
+
* )
|
|
250
|
+
* })
|
|
251
|
+
* ```
|
|
252
|
+
*
|
|
253
|
+
* @example With custom fallback
|
|
254
|
+
* ```tsx
|
|
255
|
+
* const adminRoute = createRouteConfig({
|
|
256
|
+
* path: '/admin',
|
|
257
|
+
* component: () => (
|
|
258
|
+
* <ProtectedRoute fallback={<div>Access denied</div>}>
|
|
259
|
+
* <AdminPanel />
|
|
260
|
+
* </ProtectedRoute>
|
|
261
|
+
* )
|
|
262
|
+
* })
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
const ProtectedRoute = ({ children, fallback, redirectTo, loader = null }) => {
|
|
266
|
+
const { isSignedIn, isLoading } = (0, __thunderid_react.useThunderID)();
|
|
267
|
+
if (isLoading) return loader;
|
|
268
|
+
if (isSignedIn) return children;
|
|
269
|
+
if (fallback) return fallback;
|
|
270
|
+
if (redirectTo) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__tanstack_react_router.Navigate, { to: redirectTo });
|
|
271
|
+
throw new __thunderid_react.ThunderIDRuntimeError("\"fallback\" or \"redirectTo\" prop is required.", "ProtectedRoute-ValidationError-001", "tanstack-router", "Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.");
|
|
272
|
+
};
|
|
273
|
+
var ProtectedRoute_default = ProtectedRoute;
|
|
274
|
+
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/components/CallbackRoute.tsx
|
|
277
|
+
/**
|
|
278
|
+
* Handles OAuth callback redirects for TanStack Router applications.
|
|
279
|
+
* Processes authorization code, validates CSRF state, and navigates back to the original path.
|
|
280
|
+
* Automatically handles TanStack Router basepath when configured.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```tsx
|
|
284
|
+
* const callbackRoute = createRoute({
|
|
285
|
+
* getParentRoute: () => rootRoute,
|
|
286
|
+
* path: '/callback',
|
|
287
|
+
* component: CallbackRoute,
|
|
288
|
+
* });
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
const CallbackRoute = ({ onError, onNavigate }) => {
|
|
292
|
+
const router = (0, __tanstack_react_router.useRouter)();
|
|
293
|
+
const { pathname } = (0, __tanstack_react_router.useRouterState)().location;
|
|
294
|
+
const handleNavigate = (path) => {
|
|
295
|
+
if (onNavigate) {
|
|
296
|
+
onNavigate(path);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const fullPath = window.location.pathname;
|
|
300
|
+
const basename = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\/$/, "") : "";
|
|
301
|
+
const navigationPath = basename && path.startsWith(basename) ? path.slice(basename.length) || "/" : path;
|
|
302
|
+
router.navigate({ to: navigationPath }).catch(() => {});
|
|
303
|
+
};
|
|
304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.Callback, {
|
|
305
|
+
onNavigate: handleNavigate,
|
|
306
|
+
onError: onError || ((error) => {
|
|
307
|
+
console.error("OAuth callback error:", error);
|
|
308
|
+
})
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
var CallbackRoute_default = CallbackRoute;
|
|
312
|
+
|
|
313
|
+
//#endregion
|
|
314
|
+
exports.CallbackRoute = CallbackRoute_default;
|
|
315
|
+
exports.ProtectedRoute = ProtectedRoute_default;
|
|
316
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ProtectedRoute: FC<ProtectedRouteProps>","Navigate","ThunderIDRuntimeError","CallbackRoute: FC<CallbackRouteProps>","router: ReturnType<typeof useRouter>","fullPath: string","basename: string","navigationPath: string","Callback"],"sources":["../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js","../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js","../../src/components/ProtectedRoute.tsx","../../src/components/CallbackRoute.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Navigate} from '@tanstack/react-router';\nimport {useThunderID, ThunderIDRuntimeError} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the ProtectedRoute component.\n */\nexport interface ProtectedRouteProps {\n /**\n * The element to render when the user is authenticated.\n */\n children: ReactElement;\n /**\n * Custom fallback element to render when the user is not authenticated.\n * If provided, this takes precedence over redirectTo.\n */\n fallback?: ReactElement;\n /**\n * Custom loading element to render while authentication status is being determined.\n */\n loader?: ReactNode;\n /**\n * URL to redirect to when the user is not authenticated.\n * Required unless a fallback element is provided.\n */\n redirectTo?: string;\n}\n\n/**\n * A protected route component that requires authentication to access.\n *\n * This component should be used as the component prop of a TanStack Router route.\n * It checks authentication status and either renders the protected content,\n * shows a loading state, redirects, or shows a fallback.\n *\n * Either a `redirectTo` prop or a `fallback` prop must be provided to handle\n * unauthenticated users.\n *\n * @example Basic usage with redirect\n * ```tsx\n * const dashboardRoute = createRouteConfig({\n * path: '/dashboard',\n * component: () => (\n * <ProtectedRoute redirectTo=\"/signin\">\n * <Dashboard />\n * </ProtectedRoute>\n * )\n * })\n * ```\n *\n * @example With custom fallback\n * ```tsx\n * const adminRoute = createRouteConfig({\n * path: '/admin',\n * component: () => (\n * <ProtectedRoute fallback={<div>Access denied</div>}>\n * <AdminPanel />\n * </ProtectedRoute>\n * )\n * })\n * ```\n */\nconst ProtectedRoute: FC<ProtectedRouteProps> = ({\n children,\n fallback,\n redirectTo,\n loader = null,\n}: ProtectedRouteProps) => {\n const {isSignedIn, isLoading} = useThunderID();\n\n if (isLoading) {\n return loader;\n }\n\n if (isSignedIn) {\n return children;\n }\n\n if (fallback) {\n return fallback;\n }\n\n if (redirectTo) {\n return <Navigate to={redirectTo} />;\n }\n\n throw new ThunderIDRuntimeError(\n '\"fallback\" or \"redirectTo\" prop is required.',\n 'ProtectedRoute-ValidationError-001',\n 'tanstack-router',\n 'Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.',\n );\n};\n\nexport default ProtectedRoute;\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {useRouter, useRouterState} from '@tanstack/react-router';\nimport {Callback} from '@thunderid/react';\nimport {FC} from 'react';\n\n/**\n * Props for the CallbackRoute component.\n */\nexport interface CallbackRouteProps {\n /**\n * Callback function called when an error occurs during OAuth processing.\n * @param error - The error that occurred\n */\n onError?: (error: Error) => void;\n\n /**\n * Optional custom navigation handler.\n * If provided, this will be called instead of the default navigate() behavior.\n * Useful for apps that need custom navigation logic.\n * @param path - The path to navigate to\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * Handles OAuth callback redirects for TanStack Router applications.\n * Processes authorization code, validates CSRF state, and navigates back to the original path.\n * Automatically handles TanStack Router basepath when configured.\n *\n * @example\n * ```tsx\n * const callbackRoute = createRoute({\n * getParentRoute: () => rootRoute,\n * path: '/callback',\n * component: CallbackRoute,\n * });\n * ```\n */\nconst CallbackRoute: FC<CallbackRouteProps> = ({onError, onNavigate}: CallbackRouteProps) => {\n const router: ReturnType<typeof useRouter> = useRouter();\n const routerState: ReturnType<typeof useRouterState> = useRouterState();\n const {pathname}: {pathname: string} = routerState.location;\n\n const handleNavigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n return;\n }\n\n const fullPath: string = window.location.pathname;\n const basename: string = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\\/$/, '') : '';\n\n const navigationPath: string = basename && path.startsWith(basename) ? path.slice(basename.length) || '/' : path;\n\n router.navigate({to: navigationPath}).catch(() => {});\n };\n\n return (\n <Callback\n onNavigate={handleNavigate}\n onError={\n onError ||\n ((error: Error): void => {\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', error);\n })\n }\n />\n );\n};\n\nexport default CallbackRoute;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,EACG,WAAY;EACX,SAAS,yBAAyB,MAAM;AACtC,OAAI,QAAQ,KAAM,QAAO;AACzB,OAAI,eAAe,OAAO,KACxB,QAAO,KAAK,aAAa,yBACrB,OACA,KAAK,eAAe,KAAK,QAAQ;AACvC,OAAI,aAAa,OAAO,KAAM,QAAO;AACrC,WAAQ,MAAR;IACE,KAAK,oBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,uBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,yBACH,QAAO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,QAAQ,OAAO,GAAG,GAAG;EAEhH,MAAMC,iBAAyB,YAAY,KAAK,WAAW,SAAS,GAAG,KAAK,MAAM,SAAS,OAAO,IAAI,MAAM;AAE5G,SAAO,SAAS,EAAC,IAAI,gBAAe,CAAC,CAAC,YAAY,GAAG;;AAGvD,QACE,4CAACC;EACC,YAAY;EACZ,SACE,aACE,UAAuB;AAEvB,WAAQ,MAAM,yBAAyB,MAAM;;GAGjD;;AAIN,4BAAe"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Props for the CallbackRoute component.
|
|
21
|
+
*/
|
|
22
|
+
export interface CallbackRouteProps {
|
|
23
|
+
/**
|
|
24
|
+
* Callback function called when an error occurs during OAuth processing.
|
|
25
|
+
* @param error - The error that occurred
|
|
26
|
+
*/
|
|
27
|
+
onError?: (error: Error) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Optional custom navigation handler.
|
|
30
|
+
* If provided, this will be called instead of the default navigate() behavior.
|
|
31
|
+
* Useful for apps that need custom navigation logic.
|
|
32
|
+
* @param path - The path to navigate to
|
|
33
|
+
*/
|
|
34
|
+
onNavigate?: (path: string) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Handles OAuth callback redirects for TanStack Router applications.
|
|
38
|
+
* Processes authorization code, validates CSRF state, and navigates back to the original path.
|
|
39
|
+
* Automatically handles TanStack Router basepath when configured.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* const callbackRoute = createRoute({
|
|
44
|
+
* getParentRoute: () => rootRoute,
|
|
45
|
+
* path: '/callback',
|
|
46
|
+
* component: CallbackRoute,
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare const CallbackRoute: FC<CallbackRouteProps>;
|
|
51
|
+
export default CallbackRoute;
|
|
52
|
+
//# sourceMappingURL=CallbackRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CallbackRoute.d.ts","sourceRoot":"","sources":["../../src/components/CallbackRoute.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA+BzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, ReactElement, ReactNode } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Props for the ProtectedRoute component.
|
|
21
|
+
*/
|
|
22
|
+
export interface ProtectedRouteProps {
|
|
23
|
+
/**
|
|
24
|
+
* The element to render when the user is authenticated.
|
|
25
|
+
*/
|
|
26
|
+
children: ReactElement;
|
|
27
|
+
/**
|
|
28
|
+
* Custom fallback element to render when the user is not authenticated.
|
|
29
|
+
* If provided, this takes precedence over redirectTo.
|
|
30
|
+
*/
|
|
31
|
+
fallback?: ReactElement;
|
|
32
|
+
/**
|
|
33
|
+
* Custom loading element to render while authentication status is being determined.
|
|
34
|
+
*/
|
|
35
|
+
loader?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* URL to redirect to when the user is not authenticated.
|
|
38
|
+
* Required unless a fallback element is provided.
|
|
39
|
+
*/
|
|
40
|
+
redirectTo?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A protected route component that requires authentication to access.
|
|
44
|
+
*
|
|
45
|
+
* This component should be used as the component prop of a TanStack Router route.
|
|
46
|
+
* It checks authentication status and either renders the protected content,
|
|
47
|
+
* shows a loading state, redirects, or shows a fallback.
|
|
48
|
+
*
|
|
49
|
+
* Either a `redirectTo` prop or a `fallback` prop must be provided to handle
|
|
50
|
+
* unauthenticated users.
|
|
51
|
+
*
|
|
52
|
+
* @example Basic usage with redirect
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const dashboardRoute = createRouteConfig({
|
|
55
|
+
* path: '/dashboard',
|
|
56
|
+
* component: () => (
|
|
57
|
+
* <ProtectedRoute redirectTo="/signin">
|
|
58
|
+
* <Dashboard />
|
|
59
|
+
* </ProtectedRoute>
|
|
60
|
+
* )
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example With custom fallback
|
|
65
|
+
* ```tsx
|
|
66
|
+
* const adminRoute = createRouteConfig({
|
|
67
|
+
* path: '/admin',
|
|
68
|
+
* component: () => (
|
|
69
|
+
* <ProtectedRoute fallback={<div>Access denied</div>}>
|
|
70
|
+
* <AdminPanel />
|
|
71
|
+
* </ProtectedRoute>
|
|
72
|
+
* )
|
|
73
|
+
* })
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare const ProtectedRoute: FC<ProtectedRouteProps>;
|
|
77
|
+
export default ProtectedRoute;
|
|
78
|
+
//# sourceMappingURL=ProtectedRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProtectedRoute.d.ts","sourceRoot":"","sources":["../../src/components/ProtectedRoute.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,EAAE,EAAE,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA8B3C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { default as ProtectedRoute } from './components/ProtectedRoute';
|
|
19
|
+
export * from './components/ProtectedRoute';
|
|
20
|
+
export { default as CallbackRoute } from './components/CallbackRoute';
|
|
21
|
+
export * from './components/CallbackRoute';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACtE,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACpE,cAAc,4BAA4B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { Navigate, useRouter, useRouterState } from "@tanstack/react-router";
|
|
2
|
+
import { Callback, ThunderIDRuntimeError, useThunderID } from "@thunderid/react";
|
|
3
|
+
|
|
4
|
+
//#region rolldown:runtime
|
|
5
|
+
var __create = Object.create;
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __commonJS = (cb, mod) => function() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
16
|
+
key = keys[i];
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: ((k) => from[k]).bind(null, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
29
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
30
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region ../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js
|
|
35
|
+
var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js": ((exports) => {
|
|
36
|
+
(function() {
|
|
37
|
+
function getComponentNameFromType(type) {
|
|
38
|
+
if (null == type) return null;
|
|
39
|
+
if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
40
|
+
if ("string" === typeof type) return type;
|
|
41
|
+
switch (type) {
|
|
42
|
+
case REACT_FRAGMENT_TYPE: return "Fragment";
|
|
43
|
+
case REACT_PROFILER_TYPE: return "Profiler";
|
|
44
|
+
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
45
|
+
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
46
|
+
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
47
|
+
case REACT_ACTIVITY_TYPE: return "Activity";
|
|
48
|
+
}
|
|
49
|
+
if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
50
|
+
case REACT_PORTAL_TYPE: return "Portal";
|
|
51
|
+
case REACT_CONTEXT_TYPE: return type.displayName || "Context";
|
|
52
|
+
case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer";
|
|
53
|
+
case REACT_FORWARD_REF_TYPE:
|
|
54
|
+
var innerType = type.render;
|
|
55
|
+
type = type.displayName;
|
|
56
|
+
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
57
|
+
return type;
|
|
58
|
+
case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
59
|
+
case REACT_LAZY_TYPE:
|
|
60
|
+
innerType = type._payload;
|
|
61
|
+
type = type._init;
|
|
62
|
+
try {
|
|
63
|
+
return getComponentNameFromType(type(innerType));
|
|
64
|
+
} catch (x) {}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function testStringCoercion(value) {
|
|
69
|
+
return "" + value;
|
|
70
|
+
}
|
|
71
|
+
function checkKeyStringCoercion(value) {
|
|
72
|
+
try {
|
|
73
|
+
testStringCoercion(value);
|
|
74
|
+
var JSCompiler_inline_result = !1;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
JSCompiler_inline_result = !0;
|
|
77
|
+
}
|
|
78
|
+
if (JSCompiler_inline_result) {
|
|
79
|
+
JSCompiler_inline_result = console;
|
|
80
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
81
|
+
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
82
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
83
|
+
return testStringCoercion(value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function getTaskName(type) {
|
|
87
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
88
|
+
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
89
|
+
try {
|
|
90
|
+
var name = getComponentNameFromType(type);
|
|
91
|
+
return name ? "<" + name + ">" : "<...>";
|
|
92
|
+
} catch (x) {
|
|
93
|
+
return "<...>";
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function getOwner() {
|
|
97
|
+
var dispatcher = ReactSharedInternals.A;
|
|
98
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
99
|
+
}
|
|
100
|
+
function UnknownOwner() {
|
|
101
|
+
return Error("react-stack-top-frame");
|
|
102
|
+
}
|
|
103
|
+
function hasValidKey(config) {
|
|
104
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
105
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
106
|
+
if (getter && getter.isReactWarning) return !1;
|
|
107
|
+
}
|
|
108
|
+
return void 0 !== config.key;
|
|
109
|
+
}
|
|
110
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
111
|
+
function warnAboutAccessingKey() {
|
|
112
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
113
|
+
}
|
|
114
|
+
warnAboutAccessingKey.isReactWarning = !0;
|
|
115
|
+
Object.defineProperty(props, "key", {
|
|
116
|
+
get: warnAboutAccessingKey,
|
|
117
|
+
configurable: !0
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
121
|
+
var componentName = getComponentNameFromType(this.type);
|
|
122
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
123
|
+
componentName = this.props.ref;
|
|
124
|
+
return void 0 !== componentName ? componentName : null;
|
|
125
|
+
}
|
|
126
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
127
|
+
var refProp = props.ref;
|
|
128
|
+
type = {
|
|
129
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
130
|
+
type,
|
|
131
|
+
key,
|
|
132
|
+
props,
|
|
133
|
+
_owner: owner
|
|
134
|
+
};
|
|
135
|
+
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
136
|
+
enumerable: !1,
|
|
137
|
+
get: elementRefGetterWithDeprecationWarning
|
|
138
|
+
}) : Object.defineProperty(type, "ref", {
|
|
139
|
+
enumerable: !1,
|
|
140
|
+
value: null
|
|
141
|
+
});
|
|
142
|
+
type._store = {};
|
|
143
|
+
Object.defineProperty(type._store, "validated", {
|
|
144
|
+
configurable: !1,
|
|
145
|
+
enumerable: !1,
|
|
146
|
+
writable: !0,
|
|
147
|
+
value: 0
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
150
|
+
configurable: !1,
|
|
151
|
+
enumerable: !1,
|
|
152
|
+
writable: !0,
|
|
153
|
+
value: null
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(type, "_debugStack", {
|
|
156
|
+
configurable: !1,
|
|
157
|
+
enumerable: !1,
|
|
158
|
+
writable: !0,
|
|
159
|
+
value: debugStack
|
|
160
|
+
});
|
|
161
|
+
Object.defineProperty(type, "_debugTask", {
|
|
162
|
+
configurable: !1,
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
writable: !0,
|
|
165
|
+
value: debugTask
|
|
166
|
+
});
|
|
167
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
168
|
+
return type;
|
|
169
|
+
}
|
|
170
|
+
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
171
|
+
var children = config.children;
|
|
172
|
+
if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) {
|
|
173
|
+
for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++) validateChildKeys(children[isStaticChildren]);
|
|
174
|
+
Object.freeze && Object.freeze(children);
|
|
175
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
176
|
+
else validateChildKeys(children);
|
|
177
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
178
|
+
children = getComponentNameFromType(type);
|
|
179
|
+
var keys = Object.keys(config).filter(function(k) {
|
|
180
|
+
return "key" !== k;
|
|
181
|
+
});
|
|
182
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
183
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0);
|
|
184
|
+
}
|
|
185
|
+
children = null;
|
|
186
|
+
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
187
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
188
|
+
if ("key" in config) {
|
|
189
|
+
maybeKey = {};
|
|
190
|
+
for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
|
|
191
|
+
} else maybeKey = config;
|
|
192
|
+
children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
193
|
+
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
194
|
+
}
|
|
195
|
+
function validateChildKeys(node) {
|
|
196
|
+
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
197
|
+
}
|
|
198
|
+
function isValidElement(object) {
|
|
199
|
+
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
200
|
+
}
|
|
201
|
+
var React = __require("react"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
202
|
+
return null;
|
|
203
|
+
};
|
|
204
|
+
React = { react_stack_bottom_frame: function(callStackForError) {
|
|
205
|
+
return callStackForError();
|
|
206
|
+
} };
|
|
207
|
+
var specialPropKeyWarningShown;
|
|
208
|
+
var didWarnAboutElementRef = {};
|
|
209
|
+
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
210
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
211
|
+
var didWarnAboutKeySpread = {};
|
|
212
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
213
|
+
exports.jsx = function(type, config, maybeKey) {
|
|
214
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
215
|
+
return jsxDEVImpl(type, config, maybeKey, !1, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
216
|
+
};
|
|
217
|
+
exports.jsxs = function(type, config, maybeKey) {
|
|
218
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
219
|
+
return jsxDEVImpl(type, config, maybeKey, !0, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
220
|
+
};
|
|
221
|
+
})();
|
|
222
|
+
}) });
|
|
223
|
+
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region ../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js
|
|
226
|
+
var require_jsx_runtime = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js": ((exports, module) => {
|
|
227
|
+
module.exports = require_react_jsx_runtime_development();
|
|
228
|
+
}) });
|
|
229
|
+
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/components/ProtectedRoute.tsx
|
|
232
|
+
var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
|
|
233
|
+
/**
|
|
234
|
+
* A protected route component that requires authentication to access.
|
|
235
|
+
*
|
|
236
|
+
* This component should be used as the component prop of a TanStack Router route.
|
|
237
|
+
* It checks authentication status and either renders the protected content,
|
|
238
|
+
* shows a loading state, redirects, or shows a fallback.
|
|
239
|
+
*
|
|
240
|
+
* Either a `redirectTo` prop or a `fallback` prop must be provided to handle
|
|
241
|
+
* unauthenticated users.
|
|
242
|
+
*
|
|
243
|
+
* @example Basic usage with redirect
|
|
244
|
+
* ```tsx
|
|
245
|
+
* const dashboardRoute = createRouteConfig({
|
|
246
|
+
* path: '/dashboard',
|
|
247
|
+
* component: () => (
|
|
248
|
+
* <ProtectedRoute redirectTo="/signin">
|
|
249
|
+
* <Dashboard />
|
|
250
|
+
* </ProtectedRoute>
|
|
251
|
+
* )
|
|
252
|
+
* })
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @example With custom fallback
|
|
256
|
+
* ```tsx
|
|
257
|
+
* const adminRoute = createRouteConfig({
|
|
258
|
+
* path: '/admin',
|
|
259
|
+
* component: () => (
|
|
260
|
+
* <ProtectedRoute fallback={<div>Access denied</div>}>
|
|
261
|
+
* <AdminPanel />
|
|
262
|
+
* </ProtectedRoute>
|
|
263
|
+
* )
|
|
264
|
+
* })
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
const ProtectedRoute = ({ children, fallback, redirectTo, loader = null }) => {
|
|
268
|
+
const { isSignedIn, isLoading } = useThunderID();
|
|
269
|
+
if (isLoading) return loader;
|
|
270
|
+
if (isSignedIn) return children;
|
|
271
|
+
if (fallback) return fallback;
|
|
272
|
+
if (redirectTo) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Navigate, { to: redirectTo });
|
|
273
|
+
throw new ThunderIDRuntimeError("\"fallback\" or \"redirectTo\" prop is required.", "ProtectedRoute-ValidationError-001", "tanstack-router", "Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.");
|
|
274
|
+
};
|
|
275
|
+
var ProtectedRoute_default = ProtectedRoute;
|
|
276
|
+
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/components/CallbackRoute.tsx
|
|
279
|
+
/**
|
|
280
|
+
* Handles OAuth callback redirects for TanStack Router applications.
|
|
281
|
+
* Processes authorization code, validates CSRF state, and navigates back to the original path.
|
|
282
|
+
* Automatically handles TanStack Router basepath when configured.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```tsx
|
|
286
|
+
* const callbackRoute = createRoute({
|
|
287
|
+
* getParentRoute: () => rootRoute,
|
|
288
|
+
* path: '/callback',
|
|
289
|
+
* component: CallbackRoute,
|
|
290
|
+
* });
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
const CallbackRoute = ({ onError, onNavigate }) => {
|
|
294
|
+
const router = useRouter();
|
|
295
|
+
const { pathname } = useRouterState().location;
|
|
296
|
+
const handleNavigate = (path) => {
|
|
297
|
+
if (onNavigate) {
|
|
298
|
+
onNavigate(path);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const fullPath = window.location.pathname;
|
|
302
|
+
const basename = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\/$/, "") : "";
|
|
303
|
+
const navigationPath = basename && path.startsWith(basename) ? path.slice(basename.length) || "/" : path;
|
|
304
|
+
router.navigate({ to: navigationPath }).catch(() => {});
|
|
305
|
+
};
|
|
306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Callback, {
|
|
307
|
+
onNavigate: handleNavigate,
|
|
308
|
+
onError: onError || ((error) => {
|
|
309
|
+
console.error("OAuth callback error:", error);
|
|
310
|
+
})
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
var CallbackRoute_default = CallbackRoute;
|
|
314
|
+
|
|
315
|
+
//#endregion
|
|
316
|
+
export { CallbackRoute_default as CallbackRoute, ProtectedRoute_default as ProtectedRoute };
|
|
317
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ProtectedRoute: FC<ProtectedRouteProps>","CallbackRoute: FC<CallbackRouteProps>","router: ReturnType<typeof useRouter>","fullPath: string","basename: string","navigationPath: string"],"sources":["../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js","../src/components/ProtectedRoute.tsx","../src/components/CallbackRoute.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Navigate} from '@tanstack/react-router';\nimport {useThunderID, ThunderIDRuntimeError} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the ProtectedRoute component.\n */\nexport interface ProtectedRouteProps {\n /**\n * The element to render when the user is authenticated.\n */\n children: ReactElement;\n /**\n * Custom fallback element to render when the user is not authenticated.\n * If provided, this takes precedence over redirectTo.\n */\n fallback?: ReactElement;\n /**\n * Custom loading element to render while authentication status is being determined.\n */\n loader?: ReactNode;\n /**\n * URL to redirect to when the user is not authenticated.\n * Required unless a fallback element is provided.\n */\n redirectTo?: string;\n}\n\n/**\n * A protected route component that requires authentication to access.\n *\n * This component should be used as the component prop of a TanStack Router route.\n * It checks authentication status and either renders the protected content,\n * shows a loading state, redirects, or shows a fallback.\n *\n * Either a `redirectTo` prop or a `fallback` prop must be provided to handle\n * unauthenticated users.\n *\n * @example Basic usage with redirect\n * ```tsx\n * const dashboardRoute = createRouteConfig({\n * path: '/dashboard',\n * component: () => (\n * <ProtectedRoute redirectTo=\"/signin\">\n * <Dashboard />\n * </ProtectedRoute>\n * )\n * })\n * ```\n *\n * @example With custom fallback\n * ```tsx\n * const adminRoute = createRouteConfig({\n * path: '/admin',\n * component: () => (\n * <ProtectedRoute fallback={<div>Access denied</div>}>\n * <AdminPanel />\n * </ProtectedRoute>\n * )\n * })\n * ```\n */\nconst ProtectedRoute: FC<ProtectedRouteProps> = ({\n children,\n fallback,\n redirectTo,\n loader = null,\n}: ProtectedRouteProps) => {\n const {isSignedIn, isLoading} = useThunderID();\n\n if (isLoading) {\n return loader;\n }\n\n if (isSignedIn) {\n return children;\n }\n\n if (fallback) {\n return fallback;\n }\n\n if (redirectTo) {\n return <Navigate to={redirectTo} />;\n }\n\n throw new ThunderIDRuntimeError(\n '\"fallback\" or \"redirectTo\" prop is required.',\n 'ProtectedRoute-ValidationError-001',\n 'tanstack-router',\n 'Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.',\n );\n};\n\nexport default ProtectedRoute;\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {useRouter, useRouterState} from '@tanstack/react-router';\nimport {Callback} from '@thunderid/react';\nimport {FC} from 'react';\n\n/**\n * Props for the CallbackRoute component.\n */\nexport interface CallbackRouteProps {\n /**\n * Callback function called when an error occurs during OAuth processing.\n * @param error - The error that occurred\n */\n onError?: (error: Error) => void;\n\n /**\n * Optional custom navigation handler.\n * If provided, this will be called instead of the default navigate() behavior.\n * Useful for apps that need custom navigation logic.\n * @param path - The path to navigate to\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * Handles OAuth callback redirects for TanStack Router applications.\n * Processes authorization code, validates CSRF state, and navigates back to the original path.\n * Automatically handles TanStack Router basepath when configured.\n *\n * @example\n * ```tsx\n * const callbackRoute = createRoute({\n * getParentRoute: () => rootRoute,\n * path: '/callback',\n * component: CallbackRoute,\n * });\n * ```\n */\nconst CallbackRoute: FC<CallbackRouteProps> = ({onError, onNavigate}: CallbackRouteProps) => {\n const router: ReturnType<typeof useRouter> = useRouter();\n const routerState: ReturnType<typeof useRouterState> = useRouterState();\n const {pathname}: {pathname: string} = routerState.location;\n\n const handleNavigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n return;\n }\n\n const fullPath: string = window.location.pathname;\n const basename: string = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\\/$/, '') : '';\n\n const navigationPath: string = basename && path.startsWith(basename) ? path.slice(basename.length) || '/' : path;\n\n router.navigate({to: navigationPath}).catch(() => {});\n };\n\n return (\n <Callback\n onNavigate={handleNavigate}\n onError={\n onError ||\n ((error: Error): void => {\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', error);\n })\n }\n />\n );\n};\n\nexport default CallbackR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,4CAAC,YAAS,IAAI,aAAc;AAGrC,OAAM,IAAI,sBACR,oDACA,sCACA,mBACA,+FACD;;AAGH,6BAAe;;;;;;;;;;;;;;;;;;ACzDf,MAAMC,iBAAyC,EAAC,SAAS,iBAAoC;CAC3F,MAAMC,SAAuC,WAAW;CAExD,MAAM,EAAC,aADgD,gBAAgB,CACpB;CAEnD,MAAM,kBAAkB,SAAuB;AAC7C,MAAI,YAAY;AACd,cAAW,KAAK;AAChB;;EAGF,MAAMC,WAAmB,OAAO,SAAS;EACzC,MAAMC,WAAmB,SAAS,SAAS,SAAS,GAAG,SAAS,MAAM,GAAG,CAAC,SAAS,OAAO,CAAC,QAAQ,OAAO,GAAG,GAAG;EAEhH,MAAMC,iBAAyB,YAAY,KAAK,WAAW,SAAS,GAAG,KAAK,MAAM,SAAS,OAAO,IAAI,MAAM;AAE5G,SAAO,SAAS,EAAC,IAAI,gBAAe,CAAC,CAAC,YAAY,GAAG;;AAGvD,QACE,4CAAC;EACC,YAAY;EACZ,SACE,aACE,UAAuB;AAEvB,WAAQ,MAAM,yBAAyB,MAAM;;GAGjD;;AAIN,4BAAe"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thunderid/tanstack-router",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TanStack Router integration for ThunderID",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"thunderid",
|
|
7
|
+
"react",
|
|
8
|
+
"tanstack-router",
|
|
9
|
+
"protected-routes"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/thunder-id/thunderid/tree/main/sdks/tanstack-router#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/thunder-id/thunderid/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "WSO2",
|
|
16
|
+
"license": "Apache-2.0",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "dist/cjs/index.js",
|
|
19
|
+
"module": "dist/index.js",
|
|
20
|
+
"exports": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/cjs/index.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/thunder-id/thunderid",
|
|
33
|
+
"directory": "sdks/tanstack-router"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@tanstack/react-router": "1.154.7",
|
|
37
|
+
"@testing-library/react": "16.3.0",
|
|
38
|
+
"@types/node": "24.7.2",
|
|
39
|
+
"@types/react": "19.2.14",
|
|
40
|
+
"eslint": "9.39.4",
|
|
41
|
+
"prettier": "3.6.2",
|
|
42
|
+
"react": "19.2.3",
|
|
43
|
+
"rimraf": "6.1.3",
|
|
44
|
+
"rolldown": "1.0.0-beta.45",
|
|
45
|
+
"typescript": "5.9.3",
|
|
46
|
+
"vitest": "4.1.3",
|
|
47
|
+
"@thunderid/prettier-config": "^0.0.0",
|
|
48
|
+
"@thunderid/eslint-plugin": "^0.0.0",
|
|
49
|
+
"@thunderid/react": "^0.0.1"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@tanstack/react-router": ">=1.134.4",
|
|
53
|
+
"@thunderid/react": ">=0.15.0",
|
|
54
|
+
"react": ">=16.8.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"tslib": "2.8.1"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "pnpm clean && node rolldown.config.js && tsc -p tsconfig.lib.json --emitDeclarationOnly --outDir dist",
|
|
64
|
+
"clean": "rimraf dist",
|
|
65
|
+
"format:check": "prettier --check --cache .",
|
|
66
|
+
"format:fix": "prettier --write --cache .",
|
|
67
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
68
|
+
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
69
|
+
"test": "vitest",
|
|
70
|
+
"test:browser": "vitest --workspace=vitest.workspace.ts",
|
|
71
|
+
"typecheck": "tsc -p tsconfig.lib.json"
|
|
72
|
+
}
|
|
73
|
+
}
|