authscape 1.0.718 → 1.0.722

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.
@@ -2,7 +2,9 @@
2
2
  "permissions": {
3
3
  "allow": [
4
4
  "Bash(dir:*)",
5
- "Bash(npm run build:*)"
5
+ "Bash(npm run build:*)",
6
+ "Bash(exit 0)",
7
+ "Bash(node src/scripts/postinstall.js:*)"
6
8
  ],
7
9
  "deny": [],
8
10
  "ask": []
package/index.js CHANGED
@@ -8122,6 +8122,185 @@ function YesNoDialog(_ref) {
8122
8122
  }
8123
8123
  "use strict";
8124
8124
 
8125
+ Object.defineProperty(exports, "__esModule", {
8126
+ value: true
8127
+ });
8128
+ exports.GET = GET;
8129
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8130
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8131
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
8132
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
8133
+ /**
8134
+ * AuthScape Sitemap - App Router Implementation
8135
+ * This file contains the complete sitemap logic for Next.js App Router (Route Handlers)
8136
+ * Users will re-export this from their app/sitemap.xml/route.js file
8137
+ */
8138
+ function GET(_x) {
8139
+ return _GET.apply(this, arguments);
8140
+ }
8141
+ function _GET() {
8142
+ _GET = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
8143
+ var url, protocol, host, domain, encodedDomain, apiUrl, response, sitemap;
8144
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8145
+ while (1) switch (_context.prev = _context.next) {
8146
+ case 0:
8147
+ _context.prev = 0;
8148
+ // Get the domain from the request
8149
+ url = new URL(request.url);
8150
+ protocol = request.headers.get('x-forwarded-proto') || url.protocol.replace(':', '');
8151
+ host = request.headers.get('host') || url.host;
8152
+ domain = "".concat(protocol, "://").concat(host); // URL encode the domain for the API request
8153
+ encodedDomain = encodeURIComponent(domain); // Make a basic HTTP GET request
8154
+ apiUrl = process.env.apiUri;
8155
+ if (apiUrl) {
8156
+ _context.next = 10;
8157
+ break;
8158
+ }
8159
+ console.error('AuthScape Sitemap Error: apiUri is not configured in environment variables');
8160
+ return _context.abrupt("return", new Response('Sitemap configuration error: API URI not set', {
8161
+ status: 500,
8162
+ headers: {
8163
+ 'Content-Type': 'text/plain'
8164
+ }
8165
+ }));
8166
+ case 10:
8167
+ _context.next = 12;
8168
+ return fetch("".concat(apiUrl, "/api/Sitemap?domain=").concat(encodedDomain));
8169
+ case 12:
8170
+ response = _context.sent;
8171
+ if (response.ok) {
8172
+ _context.next = 15;
8173
+ break;
8174
+ }
8175
+ throw new Error("API request failed with status ".concat(response.status));
8176
+ case 15:
8177
+ _context.next = 17;
8178
+ return response.text();
8179
+ case 17:
8180
+ sitemap = _context.sent;
8181
+ return _context.abrupt("return", new Response(sitemap, {
8182
+ status: 200,
8183
+ headers: {
8184
+ 'Content-Type': 'text/xml; charset=utf-8',
8185
+ 'Cache-Control': 'public, s-maxage=86400, stale-while-revalidate'
8186
+ }
8187
+ }));
8188
+ case 21:
8189
+ _context.prev = 21;
8190
+ _context.t0 = _context["catch"](0);
8191
+ console.error('AuthScape Sitemap Error:', _context.t0);
8192
+ return _context.abrupt("return", new Response('Error generating sitemap', {
8193
+ status: 500,
8194
+ headers: {
8195
+ 'Content-Type': 'text/plain'
8196
+ }
8197
+ }));
8198
+ case 25:
8199
+ case "end":
8200
+ return _context.stop();
8201
+ }
8202
+ }, _callee, null, [[0, 21]]);
8203
+ }));
8204
+ return _GET.apply(this, arguments);
8205
+ }
8206
+ "use strict";
8207
+
8208
+ Object.defineProperty(exports, "__esModule", {
8209
+ value: true
8210
+ });
8211
+ exports["default"] = Sitemap;
8212
+ exports.getServerSideProps = getServerSideProps;
8213
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8214
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8215
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
8216
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
8217
+ /**
8218
+ * AuthScape Sitemap - Pages Router Implementation
8219
+ * This file contains the complete sitemap logic for Next.js Pages Router
8220
+ * Users will re-export this from their pages/sitemap.xml.js file
8221
+ */
8222
+
8223
+ // Empty component - sitemap is generated server-side only
8224
+ function Sitemap() {
8225
+ return null;
8226
+ }
8227
+
8228
+ // Server-side sitemap generation
8229
+ function getServerSideProps(_x) {
8230
+ return _getServerSideProps.apply(this, arguments);
8231
+ }
8232
+ function _getServerSideProps() {
8233
+ _getServerSideProps = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
8234
+ var req, res, protocol, host, domain, encodedDomain, apiUrl, response, sitemap;
8235
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8236
+ while (1) switch (_context.prev = _context.next) {
8237
+ case 0:
8238
+ req = _ref.req, res = _ref.res;
8239
+ _context.prev = 1;
8240
+ // Get the domain from the request
8241
+ protocol = req.headers['x-forwarded-proto'] || 'http';
8242
+ host = req.headers.host;
8243
+ domain = "".concat(protocol, "://").concat(host); // URL encode the domain for the API request
8244
+ encodedDomain = encodeURIComponent(domain); // Make a basic HTTP GET request
8245
+ apiUrl = process.env.apiUri;
8246
+ if (apiUrl) {
8247
+ _context.next = 14;
8248
+ break;
8249
+ }
8250
+ console.error('AuthScape Sitemap Error: apiUri is not configured in environment variables');
8251
+ res.statusCode = 500;
8252
+ res.setHeader('Content-Type', 'text/plain');
8253
+ res.write('Sitemap configuration error: API URI not set');
8254
+ res.end();
8255
+ return _context.abrupt("return", {
8256
+ props: {}
8257
+ });
8258
+ case 14:
8259
+ _context.next = 16;
8260
+ return fetch("".concat(apiUrl, "/api/Sitemap?domain=").concat(encodedDomain));
8261
+ case 16:
8262
+ response = _context.sent;
8263
+ if (response.ok) {
8264
+ _context.next = 19;
8265
+ break;
8266
+ }
8267
+ throw new Error("API request failed with status ".concat(response.status));
8268
+ case 19:
8269
+ _context.next = 21;
8270
+ return response.text();
8271
+ case 21:
8272
+ sitemap = _context.sent;
8273
+ // Set the appropriate headers for XML
8274
+ res.setHeader('Content-Type', 'text/xml; charset=utf-8');
8275
+ res.setHeader('Cache-Control', 'public, s-maxage=86400, stale-while-revalidate');
8276
+
8277
+ // Send the XML response
8278
+ res.write(sitemap);
8279
+ res.end();
8280
+ return _context.abrupt("return", {
8281
+ props: {}
8282
+ });
8283
+ case 29:
8284
+ _context.prev = 29;
8285
+ _context.t0 = _context["catch"](1);
8286
+ console.error('AuthScape Sitemap Error:', _context.t0);
8287
+ res.statusCode = 500;
8288
+ res.setHeader('Content-Type', 'text/plain');
8289
+ res.write('Error generating sitemap');
8290
+ res.end();
8291
+ return _context.abrupt("return", {
8292
+ props: {}
8293
+ });
8294
+ case 37:
8295
+ case "end":
8296
+ return _context.stop();
8297
+ }
8298
+ }, _callee, null, [[1, 29]]);
8299
+ }));
8300
+ return _getServerSideProps.apply(this, arguments);
8301
+ }
8302
+ "use strict";
8303
+
8125
8304
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8126
8305
  Object.defineProperty(exports, "__esModule", {
8127
8306
  value: true
@@ -9492,33 +9671,3 @@ var setCookie = exports.setCookie = function setCookie(name, value) {
9492
9671
  resolve();
9493
9672
  });
9494
9673
  };
9495
- "use strict";
9496
-
9497
- Object.defineProperty(exports, "__esModule", {
9498
- value: true
9499
- });
9500
- exports["default"] = Sitemap;
9501
- exports.getServerSideProps = void 0;
9502
- var _sitemapService = require("authscape/src/services/sitemapService");
9503
- /**
9504
- * AuthScape Sitemap.xml Template
9505
- *
9506
- * USAGE:
9507
- * Copy this file to your Next.js pages directory as: pages/sitemap.xml.js
9508
- *
9509
- * The sitemap will automatically be generated and available at:
9510
- * https://yourdomain.com/sitemap.xml
9511
- *
9512
- * CONFIGURATION:
9513
- * Ensure process.env.apiUri is set in your .env.local file:
9514
- * apiUri=https://your-authscape-api.com
9515
- */
9516
-
9517
- function Sitemap() {
9518
- // This component will never render - sitemap is generated server-side
9519
- return null;
9520
- }
9521
-
9522
- // Export the pre-configured sitemap handler
9523
- // It will automatically use process.env.apiUri from your environment
9524
- var getServerSideProps = exports.getServerSideProps = (0, _sitemapService.createSitemapHandler)();
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.718",
3
+ "version": "1.0.722",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "npx babel src --out-file index.js"
8
+ "build": "npx babel src --out-file index.js --ignore \"src/scripts/**\"",
9
+ "postinstall": "node src/scripts/postinstall.js || exit 0"
9
10
  },
10
11
  "author": "zuechb",
11
12
  "license": "ISC",
package/readme.md CHANGED
@@ -1 +1,103 @@
1
- Working on docs...
1
+ # AuthScape NPM Package
2
+
3
+ Complete authentication and user management solution for Next.js applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install authscape
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ See the main [AuthScape Documentation](https://authscape.com/docs) for complete setup instructions.
14
+
15
+ ## Features
16
+
17
+ ### Core Features
18
+ - OAuth2/PKCE Authentication
19
+ - Multi-tenant support
20
+ - User management
21
+ - Role-based permissions
22
+ - Analytics integration (GA4, Microsoft Clarity)
23
+ - Material-UI components
24
+
25
+ ### Components
26
+ - Document Manager
27
+ - File Uploader
28
+ - Rich Text Editor
29
+ - Data Tables
30
+ - Stripe Payment Integration
31
+ - Google Maps Integration
32
+ - And more...
33
+
34
+ ## Additional Features
35
+
36
+ ### Sitemap Generation (NEW!)
37
+
38
+ Automatically generate SEO-friendly sitemaps for your Next.js application.
39
+
40
+ **Automatic setup on install:**
41
+
42
+ When you run `npm install authscape`, a sitemap is automatically configured at `/sitemap.xml` that syncs with your AuthScape content.
43
+
44
+ - Supports both Pages Router and App Router
45
+ - Automatically detects your Next.js project structure
46
+ - Works with both `pages/` and `src/pages/` layouts
47
+ - Works with both `app/` and `src/app/` layouts
48
+
49
+ **To disable:** Simply delete the auto-generated file:
50
+ - Pages Router: `pages/sitemap.xml.js`
51
+ - App Router: `app/sitemap.xml/route.js`
52
+
53
+ ## Environment Variables
54
+
55
+ Required environment variables in your `.env.local`:
56
+
57
+ ```env
58
+ apiUri=https://your-authscape-api.com
59
+ authorityUri=https://your-auth-server.com
60
+ client_id=your-client-id
61
+ client_secret=your-client-secret
62
+ ```
63
+
64
+ Optional analytics:
65
+
66
+ ```env
67
+ googleAnalytics4=G-XXXXXXXXXX
68
+ microsoftClarityTrackingCode=xxxxxxxxxx
69
+ enableDatabaseAnalytics=true
70
+ ```
71
+
72
+ ## Usage Example
73
+
74
+ ```javascript
75
+ // pages/_app.js
76
+ import { AuthScapeApp } from 'authscape';
77
+ import 'react-toastify/dist/ReactToastify.css';
78
+
79
+ function MyApp({ Component, pageProps }) {
80
+ return (
81
+ <AuthScapeApp
82
+ Component={Component}
83
+ pageProps={pageProps}
84
+ enforceLoggedIn={false}
85
+ enableAuth={true}
86
+ />
87
+ );
88
+ }
89
+
90
+ export default MyApp;
91
+ ```
92
+
93
+ ## Documentation
94
+
95
+ - [AuthScape Docs](https://authscape.com/docs) - Complete documentation
96
+
97
+ ## Support
98
+
99
+ For issues or questions, contact AuthScape support or visit [authscape.com](https://authscape.com).
100
+
101
+ ## License
102
+
103
+ ISC
@@ -0,0 +1,58 @@
1
+ /**
2
+ * AuthScape Sitemap - App Router Implementation
3
+ * This file contains the complete sitemap logic for Next.js App Router (Route Handlers)
4
+ * Users will re-export this from their app/sitemap.xml/route.js file
5
+ */
6
+
7
+ export async function GET(request) {
8
+ try {
9
+ // Get the domain from the request
10
+ const url = new URL(request.url);
11
+ const protocol = request.headers.get('x-forwarded-proto') || url.protocol.replace(':', '');
12
+ const host = request.headers.get('host') || url.host;
13
+ const domain = `${protocol}://${host}`;
14
+
15
+ // URL encode the domain for the API request
16
+ const encodedDomain = encodeURIComponent(domain);
17
+
18
+ // Make a basic HTTP GET request
19
+ const apiUrl = process.env.apiUri;
20
+
21
+ if (!apiUrl) {
22
+ console.error('AuthScape Sitemap Error: apiUri is not configured in environment variables');
23
+ return new Response('Sitemap configuration error: API URI not set', {
24
+ status: 500,
25
+ headers: {
26
+ 'Content-Type': 'text/plain',
27
+ },
28
+ });
29
+ }
30
+
31
+ const response = await fetch(`${apiUrl}/api/Sitemap?domain=${encodedDomain}`);
32
+
33
+ if (!response.ok) {
34
+ throw new Error(`API request failed with status ${response.status}`);
35
+ }
36
+
37
+ // Get the sitemap XML
38
+ const sitemap = await response.text();
39
+
40
+ // Return the XML response with appropriate headers
41
+ return new Response(sitemap, {
42
+ status: 200,
43
+ headers: {
44
+ 'Content-Type': 'text/xml; charset=utf-8',
45
+ 'Cache-Control': 'public, s-maxage=86400, stale-while-revalidate',
46
+ },
47
+ });
48
+ } catch (error) {
49
+ console.error('AuthScape Sitemap Error:', error);
50
+
51
+ return new Response('Error generating sitemap', {
52
+ status: 500,
53
+ headers: {
54
+ 'Content-Type': 'text/plain',
55
+ },
56
+ });
57
+ }
58
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * AuthScape Sitemap - Pages Router Implementation
3
+ * This file contains the complete sitemap logic for Next.js Pages Router
4
+ * Users will re-export this from their pages/sitemap.xml.js file
5
+ */
6
+
7
+ // Empty component - sitemap is generated server-side only
8
+ export default function Sitemap() {
9
+ return null;
10
+ }
11
+
12
+ // Server-side sitemap generation
13
+ export async function getServerSideProps({ req, res }) {
14
+ try {
15
+ // Get the domain from the request
16
+ const protocol = req.headers['x-forwarded-proto'] || 'http';
17
+ const host = req.headers.host;
18
+ const domain = `${protocol}://${host}`;
19
+
20
+ // URL encode the domain for the API request
21
+ const encodedDomain = encodeURIComponent(domain);
22
+
23
+ // Make a basic HTTP GET request
24
+ const apiUrl = process.env.apiUri;
25
+
26
+ if (!apiUrl) {
27
+ console.error('AuthScape Sitemap Error: apiUri is not configured in environment variables');
28
+ res.statusCode = 500;
29
+ res.setHeader('Content-Type', 'text/plain');
30
+ res.write('Sitemap configuration error: API URI not set');
31
+ res.end();
32
+ return { props: {} };
33
+ }
34
+
35
+ let response = await fetch(`${apiUrl}/api/Sitemap?domain=${encodedDomain}`);
36
+
37
+ if (!response.ok) {
38
+ throw new Error(`API request failed with status ${response.status}`);
39
+ }
40
+
41
+ // Generate the sitemap XML
42
+ const sitemap = await response.text();
43
+
44
+ // Set the appropriate headers for XML
45
+ res.setHeader('Content-Type', 'text/xml; charset=utf-8');
46
+ res.setHeader('Cache-Control', 'public, s-maxage=86400, stale-while-revalidate');
47
+
48
+ // Send the XML response
49
+ res.write(sitemap);
50
+ res.end();
51
+
52
+ return {
53
+ props: {},
54
+ };
55
+ } catch (error) {
56
+ console.error('AuthScape Sitemap Error:', error);
57
+
58
+ res.statusCode = 500;
59
+ res.setHeader('Content-Type', 'text/plain');
60
+ res.write('Error generating sitemap');
61
+ res.end();
62
+
63
+ return {
64
+ props: {},
65
+ };
66
+ }
67
+ }
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * AuthScape Post-Install Script
5
+ * Automatically sets up sitemap.xml for Next.js projects (both Pages Router and App Router)
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+
11
+ // Template for Pages Router
12
+ const PAGES_ROUTER_TEMPLATE = `// Auto-generated by AuthScape - Do not edit manually
13
+ export { default, getServerSideProps } from 'authscape/lib/sitemap';
14
+ `;
15
+
16
+ // Template for App Router
17
+ const APP_ROUTER_TEMPLATE = `// Auto-generated by AuthScape - Do not edit manually
18
+ export { GET } from 'authscape/lib/sitemap-route';
19
+ `;
20
+
21
+ function detectProjectStructure() {
22
+ // Get the parent directory where the user ran npm install
23
+ // This goes up from node_modules/authscape to the project root
24
+ const projectRoot = path.resolve(process.cwd(), '../..');
25
+
26
+ // Check for App Router (prioritize newer approach)
27
+ const appDirs = [
28
+ path.join(projectRoot, 'app'),
29
+ path.join(projectRoot, 'src', 'app'),
30
+ ];
31
+
32
+ for (const dir of appDirs) {
33
+ if (fs.existsSync(dir)) {
34
+ return {
35
+ type: 'app',
36
+ baseDir: dir,
37
+ sitemapPath: path.join(dir, 'sitemap.xml'),
38
+ filePath: path.join(dir, 'sitemap.xml', 'route.js'),
39
+ };
40
+ }
41
+ }
42
+
43
+ // Check for Pages Router
44
+ const pagesDirs = [
45
+ path.join(projectRoot, 'pages'),
46
+ path.join(projectRoot, 'src', 'pages'),
47
+ ];
48
+
49
+ for (const dir of pagesDirs) {
50
+ if (fs.existsSync(dir)) {
51
+ return {
52
+ type: 'pages',
53
+ baseDir: dir,
54
+ sitemapPath: path.join(dir, 'sitemap.xml.js'),
55
+ filePath: path.join(dir, 'sitemap.xml.js'),
56
+ };
57
+ }
58
+ }
59
+
60
+ return null;
61
+ }
62
+
63
+ function setupSitemap() {
64
+ const structure = detectProjectStructure();
65
+
66
+ if (!structure) {
67
+ console.log('⚠️ Next.js pages/app directory not found. Skipping sitemap setup.');
68
+ console.log(' To set up manually, visit: https://authscape.com/docs/sitemap');
69
+ return;
70
+ }
71
+
72
+ // Check if sitemap file already exists
73
+ if (fs.existsSync(structure.filePath)) {
74
+ // File exists, don't overwrite
75
+ return;
76
+ }
77
+
78
+ try {
79
+ if (structure.type === 'app') {
80
+ // App Router: Create directory first, then route.js inside it
81
+ if (!fs.existsSync(structure.sitemapPath)) {
82
+ fs.mkdirSync(structure.sitemapPath, { recursive: true });
83
+ }
84
+ fs.writeFileSync(structure.filePath, APP_ROUTER_TEMPLATE, 'utf8');
85
+ console.log('✅ AuthScape sitemap configured at /sitemap.xml (App Router)');
86
+ } else {
87
+ // Pages Router: Just create the file
88
+ fs.writeFileSync(structure.filePath, PAGES_ROUTER_TEMPLATE, 'utf8');
89
+ console.log('✅ AuthScape sitemap configured at /sitemap.xml (Pages Router)');
90
+ }
91
+ } catch (error) {
92
+ // Silent failure - don't break the install
93
+ console.log('⚠️ Could not auto-configure sitemap:', error.message);
94
+ console.log(' To set up manually, visit: https://authscape.com/docs/sitemap');
95
+ }
96
+ }
97
+
98
+ // Run the setup
99
+ try {
100
+ setupSitemap();
101
+ } catch (error) {
102
+ // Completely silent failure to avoid breaking npm install
103
+ // Only log if there's an unexpected error
104
+ if (process.env.DEBUG) {
105
+ console.error('AuthScape postinstall error:', error);
106
+ }
107
+ }
package/SITEMAP_SETUP.md DELETED
@@ -1,215 +0,0 @@
1
- # AuthScape Sitemap Integration
2
-
3
- Automatically generate and serve a sitemap.xml for your Next.js application using the AuthScape API.
4
-
5
- ## Features
6
-
7
- - Automatic sitemap.xml generation from your AuthScape API
8
- - Server-side rendering for SEO optimization
9
- - Automatic caching with stale-while-revalidate strategy
10
- - Domain-aware (works with multi-tenant setups)
11
- - Zero configuration required (uses existing AuthScape settings)
12
-
13
- ## Quick Setup (2 minutes)
14
-
15
- ### Step 1: Copy the Template File
16
-
17
- Copy the sitemap template to your Next.js pages directory:
18
-
19
- ```bash
20
- # From your project root
21
- cp node_modules/authscape/src/templates/sitemap.xml.js pages/sitemap.xml.js
22
- ```
23
-
24
- Or manually create `pages/sitemap.xml.js` with this content:
25
-
26
- ```javascript
27
- import { createSitemapHandler } from 'authscape/src/services/sitemapService';
28
-
29
- export default function Sitemap() {
30
- return null;
31
- }
32
-
33
- export const getServerSideProps = createSitemapHandler();
34
- ```
35
-
36
- ### Step 2: Ensure Environment Variable is Set
37
-
38
- Make sure your `.env.local` file has the `apiUri` configured:
39
-
40
- ```env
41
- apiUri=https://your-authscape-api.com
42
- ```
43
-
44
- ### Step 3: Test It
45
-
46
- Visit your sitemap in your browser:
47
-
48
- ```
49
- http://localhost:3000/sitemap.xml
50
- ```
51
-
52
- Or in production:
53
-
54
- ```
55
- https://yourdomain.com/sitemap.xml
56
- ```
57
-
58
- That's it! Your sitemap is now live and automatically updating.
59
-
60
- ## How It Works
61
-
62
- 1. When a user requests `/sitemap.xml`, Next.js calls the `getServerSideProps` function
63
- 2. The sitemap service extracts the current domain from the request headers
64
- 3. It calls your AuthScape API at `/api/Sitemap?domain={yourdomain}`
65
- 4. The API returns the sitemap XML based on your content
66
- 5. The response is cached for 24 hours with stale-while-revalidate
67
-
68
- ## Advanced Usage
69
-
70
- ### Custom API URI
71
-
72
- If you need to override the API URI for a specific environment:
73
-
74
- ```javascript
75
- import { createSitemapHandler } from 'authscape/src/services/sitemapService';
76
-
77
- export default function Sitemap() {
78
- return null;
79
- }
80
-
81
- // Override the API URI
82
- export const getServerSideProps = createSitemapHandler('https://custom-api.com');
83
- ```
84
-
85
- ### Manual Control
86
-
87
- If you need more control over the sitemap generation:
88
-
89
- ```javascript
90
- import { generateSitemap } from 'authscape/src/services/sitemapService';
91
-
92
- export default function Sitemap() {
93
- return null;
94
- }
95
-
96
- export async function getServerSideProps({ req, res }) {
97
- const apiUri = process.env.apiUri;
98
-
99
- // Add custom logic here
100
- console.log('Generating sitemap for:', req.headers.host);
101
-
102
- // Call the sitemap generator
103
- return await generateSitemap(req, res, apiUri);
104
- }
105
- ```
106
-
107
- ### Custom Cache Headers
108
-
109
- To change the cache duration, modify the response headers:
110
-
111
- ```javascript
112
- import { generateSitemap } from 'authscape/src/services/sitemapService';
113
-
114
- export default function Sitemap() {
115
- return null;
116
- }
117
-
118
- export async function getServerSideProps({ req, res }) {
119
- const result = await generateSitemap(req, res, process.env.apiUri);
120
-
121
- // Override cache to 1 hour instead of 24 hours
122
- res.setHeader('Cache-Control', 'public, s-maxage=3600, stale-while-revalidate');
123
-
124
- return result;
125
- }
126
- ```
127
-
128
- ## Multi-Tenant Support
129
-
130
- The sitemap service automatically detects the current domain from the request headers, making it work seamlessly with AuthScape's multi-tenant features. Each domain will receive its own sitemap based on the content configured in the AuthScape API.
131
-
132
- ## Troubleshooting
133
-
134
- ### Sitemap returns 500 error
135
-
136
- - Check that `process.env.apiUri` is properly configured
137
- - Verify your AuthScape API is accessible
138
- - Check the server logs for the error message
139
-
140
- ### Sitemap is empty
141
-
142
- - Verify your AuthScape API returns valid sitemap data at `/api/Sitemap?domain={yourdomain}`
143
- - Test the API endpoint directly in your browser or Postman
144
-
145
- ### Sitemap not updating
146
-
147
- - The sitemap is cached for 24 hours by default
148
- - Clear your browser cache or use incognito mode
149
- - Modify the cache headers to a shorter duration during development
150
-
151
- ## API Reference
152
-
153
- ### `createSitemapHandler(apiUri?)`
154
-
155
- Creates a `getServerSideProps` function configured for sitemap generation.
156
-
157
- **Parameters:**
158
- - `apiUri` (string, optional): Override the API URI. Defaults to `process.env.apiUri`
159
-
160
- **Returns:**
161
- - Function: A `getServerSideProps` function
162
-
163
- **Example:**
164
- ```javascript
165
- export const getServerSideProps = createSitemapHandler();
166
- ```
167
-
168
- ### `generateSitemap(req, res, apiUri)`
169
-
170
- Lower-level function for generating sitemaps with custom logic.
171
-
172
- **Parameters:**
173
- - `req` (NextApiRequest): Next.js request object
174
- - `res` (NextApiResponse): Next.js response object
175
- - `apiUri` (string): The AuthScape API base URI
176
-
177
- **Returns:**
178
- - Promise<{ props: {} }>: Next.js getServerSideProps return value
179
-
180
- **Example:**
181
- ```javascript
182
- export async function getServerSideProps({ req, res }) {
183
- return await generateSitemap(req, res, process.env.apiUri);
184
- }
185
- ```
186
-
187
- ## SEO Benefits
188
-
189
- Having a sitemap.xml provides several SEO benefits:
190
-
191
- 1. **Faster Indexing**: Search engines discover your content faster
192
- 2. **Complete Coverage**: Ensures all pages are found, even if not linked
193
- 3. **Priority Signals**: Can indicate which pages are most important
194
- 4. **Change Frequency**: Signals how often content is updated
195
- 5. **Multi-lingual Support**: Can include alternate language versions
196
-
197
- ## Integration with robots.txt
198
-
199
- Don't forget to reference your sitemap in your `robots.txt` file:
200
-
201
- Create `public/robots.txt`:
202
-
203
- ```txt
204
- User-agent: *
205
- Allow: /
206
-
207
- Sitemap: https://yourdomain.com/sitemap.xml
208
- ```
209
-
210
- ## Support
211
-
212
- For issues or questions:
213
- - Check the [AuthScape Documentation](https://authscape.com/docs)
214
- - Contact AuthScape Support
215
- - Review the source code in `node_modules/authscape/src/services/sitemapService.js`
@@ -1,24 +0,0 @@
1
- /**
2
- * AuthScape Sitemap.xml Template
3
- *
4
- * USAGE:
5
- * Copy this file to your Next.js pages directory as: pages/sitemap.xml.js
6
- *
7
- * The sitemap will automatically be generated and available at:
8
- * https://yourdomain.com/sitemap.xml
9
- *
10
- * CONFIGURATION:
11
- * Ensure process.env.apiUri is set in your .env.local file:
12
- * apiUri=https://your-authscape-api.com
13
- */
14
-
15
- import { createSitemapHandler } from 'authscape/src/services/sitemapService';
16
-
17
- export default function Sitemap() {
18
- // This component will never render - sitemap is generated server-side
19
- return null;
20
- }
21
-
22
- // Export the pre-configured sitemap handler
23
- // It will automatically use process.env.apiUri from your environment
24
- export const getServerSideProps = createSitemapHandler();