@digigov/nextjs 1.1.3 → 1.1.5-0c4be34e

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/App/index.js CHANGED
@@ -1,49 +1,42 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
7
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
- import React from 'react';
9
- import App from 'next/app';
10
- import Head from 'next/head';
11
- import { withTranslation } from 'react-i18next';
12
- import NextLink from '@digigov/nextjs/Link';
13
- import DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';
14
- import { I18NProvider } from '@digigov/ui/i18n';
15
- import { LinkProvider } from '@digigov/ui/navigation/Link';
16
- var _ref = /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("meta", {
17
- name: "viewport",
18
- content: "minimum-scale=1, initial-scale=1, width=device-width"
19
- }));
20
- var DigiGOVNextApp = /*#__PURE__*/function (_App) {
21
- _inherits(DigiGOVNextApp, _App);
22
- function DigiGOVNextApp() {
23
- _classCallCheck(this, DigiGOVNextApp);
24
- return _callSuper(this, DigiGOVNextApp, arguments);
25
- }
26
- _createClass(DigiGOVNextApp, [{
27
- key: "render",
28
- value: function render() {
29
- var _this$props = this.props,
30
- Component = _this$props.Component,
31
- pageProps = _this$props.pageProps,
32
- _t = _this$props.t,
33
- i18n = _this$props.i18n,
34
- _this$props$ssr = _this$props.ssr,
35
- ssr = _this$props$ssr === void 0 ? false : _this$props$ssr;
36
- return /*#__PURE__*/React.createElement(I18NProvider, {
37
- t: function t(str) {
38
- return typeof str === 'string' ? _t(str) : str;
39
- },
40
- i18n: i18n
41
- }, /*#__PURE__*/React.createElement(LinkProvider, {
42
- component: NextLink
43
- }, _ref, ssr ? /*#__PURE__*/React.createElement(DigiGOVApp, null, /*#__PURE__*/React.createElement(Component, pageProps)) : /*#__PURE__*/React.createElement(StaticApp, null, /*#__PURE__*/React.createElement(Component, pageProps))));
1
+ import React from "react";
2
+ import App from "next/app";
3
+ import Head from "next/head";
4
+ import { useRouter } from "next/router";
5
+ import { withTranslation } from "react-i18next";
6
+ import NextLink from "@digigov/nextjs/Link";
7
+ import DigiGOVApp, { StaticApp } from "@digigov/ui/app/App";
8
+ import { I18NProvider } from "@digigov/ui/i18n";
9
+ import { LinkProvider } from "@digigov/ui/navigation/Link";
10
+ class DigiGOVNextAppClass extends App {
11
+ render() {
12
+ const { Component, pageProps, t, i18n: i18n2, ssr = false, router } = this.props;
13
+ const { locale } = router;
14
+ if (locale && i18n2.language != locale) {
15
+ i18n2.changeLanguage(locale);
44
16
  }
45
- }]);
46
- return DigiGOVNextApp;
47
- }(App);
48
- var DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
49
- export default DigiGOVNextAppWithTranslation;
17
+ return /* @__PURE__ */ React.createElement(
18
+ I18NProvider,
19
+ {
20
+ t: (str) => typeof str === "string" ? t(str) : str,
21
+ i18n: i18n2
22
+ },
23
+ /* @__PURE__ */ React.createElement(LinkProvider, { component: NextLink }, /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement(
24
+ "meta",
25
+ {
26
+ name: "viewport",
27
+ content: "minimum-scale=1, initial-scale=1, width=device-width"
28
+ }
29
+ )), ssr ? /* @__PURE__ */ React.createElement(DigiGOVApp, null, /* @__PURE__ */ React.createElement(Component, { ...pageProps })) : /* @__PURE__ */ React.createElement(StaticApp, null, /* @__PURE__ */ React.createElement(Component, { ...pageProps })))
30
+ );
31
+ }
32
+ }
33
+ const DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextAppClass);
34
+ const DigiGOVNextApp = (props) => {
35
+ const router = useRouter();
36
+ return /* @__PURE__ */ React.createElement(DigiGOVNextAppWithTranslation, { ...props, router });
37
+ };
38
+ var App_default = DigiGOVNextApp;
39
+ export {
40
+ App_default as default
41
+ };
42
+ //# sourceMappingURL=App.js.map
package/App.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { i18n, TFunction } from 'i18next';
3
+ import { NextRouter } from 'next/router';
3
4
  import { WithTranslation } from 'react-i18next';
4
5
  import type { AppProps } from '@digigov/ui/app/App';
5
6
  export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
@@ -7,11 +8,7 @@ export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
7
8
  t: TFunction;
8
9
  i18n: i18n;
9
10
  ssr: boolean;
11
+ router: NextRouter;
10
12
  }
11
- declare const DigiGOVNextAppWithTranslation: React.ComponentType<import("react-i18next").Omit<DigiGOVNextAppProps & import("next/app").AppInitialProps & {
12
- Component: import("next").NextComponentType<import("next").NextPageContext, any, {}>;
13
- router: import("next/router").Router;
14
- __N_SSG?: boolean | undefined;
15
- __N_SSP?: boolean | undefined;
16
- }, keyof WithTranslation> & import("react-i18next").WithTranslationProps>;
17
- export default DigiGOVNextAppWithTranslation;
13
+ declare const DigiGOVNextApp: (props: any) => React.JSX.Element;
14
+ export default DigiGOVNextApp;
package/App.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/App.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport { i18n, TFunction } from 'i18next';\nimport App from 'next/app';\nimport Head from 'next/head';\nimport { NextRouter, useRouter } from 'next/router';\nimport { withTranslation, WithTranslation } from 'react-i18next';\nimport NextLink from '@digigov/nextjs/Link';\nimport DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';\nimport type { AppProps } from '@digigov/ui/app/App';\nimport { I18NProvider } from '@digigov/ui/i18n';\nimport { LinkProvider } from '@digigov/ui/navigation/Link';\n\nexport interface DigiGOVNextAppProps extends AppProps, WithTranslation {\n children?: React.ReactNode;\n t: TFunction;\n i18n: i18n;\n ssr: boolean;\n router: NextRouter;\n}\nclass DigiGOVNextAppClass extends App<DigiGOVNextAppProps> {\n render(): React.ReactElement {\n const { Component, pageProps, t, i18n, ssr = false, router } = this.props;\n const { locale } = router;\n\n if (locale && i18n.language != locale) {\n i18n.changeLanguage(locale);\n }\n return (\n <I18NProvider\n t={(str) => (typeof str === 'string' ? t(str) : str)}\n i18n={i18n}\n >\n <LinkProvider component={NextLink}>\n <Head>\n <meta\n name=\"viewport\"\n content=\"minimum-scale=1, initial-scale=1, width=device-width\"\n />\n </Head>\n {ssr ? (\n <DigiGOVApp>\n <Component {...pageProps} />\n </DigiGOVApp>\n ) : (\n <StaticApp>\n <Component {...pageProps} />\n </StaticApp>\n )}\n </LinkProvider>\n </I18NProvider>\n );\n }\n}\n\nconst DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextAppClass);\nconst DigiGOVNextApp = (props) => {\n const router = useRouter();\n return <DigiGOVNextAppWithTranslation {...props} router={router} />;\n};\nexport default DigiGOVNextApp;\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAElB,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,SAAqB,iBAAiB;AACtC,SAAS,uBAAwC;AACjD,OAAO,cAAc;AACrB,OAAO,cAAc,iBAAiB;AAEtC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAS7B,MAAM,4BAA4B,IAAyB;AAAA,EACzD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAA,OAAM,MAAM,OAAO,OAAO,IAAI,KAAK;AACpE,UAAM,EAAE,OAAO,IAAI;AAEnB,QAAI,UAAUA,MAAK,YAAY,QAAQ;AACrC,MAAAA,MAAK,eAAe,MAAM;AAAA,IAC5B;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,GAAG,CAAC,QAAS,OAAO,QAAQ,WAAW,EAAE,GAAG,IAAI;AAAA,QAChD,MAAMA;AAAA;AAAA,MAEN,oCAAC,gBAAa,WAAW,YACvB,oCAAC,YACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA;AAAA,MACV,CACF,GACC,MACC,oCAAC,kBACC,oCAAC,aAAW,GAAG,WAAW,CAC5B,IAEA,oCAAC,iBACC,oCAAC,aAAW,GAAG,WAAW,CAC5B,CAEJ;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,MAAM,gCAAgC,gBAAgB,EAAE,mBAAmB;AAC3E,MAAM,iBAAiB,CAAC,UAAU;AAChC,QAAM,SAAS,UAAU;AACzB,SAAO,oCAAC,iCAA+B,GAAG,OAAO,QAAgB;AACnE;AACA,IAAO,cAAQ;",
6
+ "names": ["i18n"]
7
+ }
package/Document/index.js CHANGED
@@ -1,68 +1,27 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _extends from "@babel/runtime/helpers/extends";
3
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _inherits from "@babel/runtime/helpers/inherits";
9
- 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 new 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 new 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 new 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; }
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
13
- import React from 'react';
14
- import Document, { Html, Head, Main, NextScript } from 'next/document';
15
- var _ref = /*#__PURE__*/React.createElement("link", {
16
- rel: "stylesheet",
17
- href: "https://fonts.googleapis.com/icon?family=Material+Icons"
18
- });
19
- var _ref2 = /*#__PURE__*/React.createElement("link", {
20
- rel: "stylesheet",
21
- href: "https://fonts.googleapis.com/css?family=Roboto:300,400,500"
22
- });
23
- export function Fonts() {
24
- return /*#__PURE__*/React.createElement(React.Fragment, null, _ref, _ref2);
25
- }
26
- var _ref3 = /*#__PURE__*/React.createElement(Fonts, null);
27
- var _ref4 = /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(Main, null), /*#__PURE__*/React.createElement(NextScript, null));
28
- var DigiGOVDocument = /*#__PURE__*/function (_Document) {
29
- _inherits(DigiGOVDocument, _Document);
30
- function DigiGOVDocument() {
31
- _classCallCheck(this, DigiGOVDocument);
32
- return _callSuper(this, DigiGOVDocument, arguments);
33
- }
34
- _createClass(DigiGOVDocument, [{
35
- key: "render",
36
- value: function render() {
37
- return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("script", {
1
+ import React from "react";
2
+ import Document, { Html, Head, Main, NextScript } from "next/document";
3
+ class DigiGOVDocument extends Document {
4
+ render() {
5
+ return /* @__PURE__ */ React.createElement(Html, null, /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement(
6
+ "script",
7
+ {
38
8
  type: "text/javascript",
39
9
  dangerouslySetInnerHTML: {
40
- __html: "if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n"
10
+ __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
11
+ `
41
12
  }
42
- }), _ref3), _ref4);
43
- }
44
- }]);
45
- return DigiGOVDocument;
46
- }(Document);
47
- export { DigiGOVDocument as default };
48
- DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
49
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
50
- var initialProps;
51
- return _regeneratorRuntime().wrap(function _callee$(_context) {
52
- while (1) switch (_context.prev = _context.next) {
53
- case 0:
54
- _context.next = 2;
55
- return Document.getInitialProps(ctx);
56
- case 2:
57
- initialProps = _context.sent;
58
- return _context.abrupt("return", _extends({}, initialProps));
59
- case 4:
60
- case "end":
61
- return _context.stop();
62
13
  }
63
- }, _callee);
64
- }));
65
- return function (_x) {
66
- return _ref5.apply(this, arguments);
14
+ )), /* @__PURE__ */ React.createElement("body", null, /* @__PURE__ */ React.createElement(Main, null), /* @__PURE__ */ React.createElement(NextScript, null)));
15
+ }
16
+ }
17
+ DigiGOVDocument.getInitialProps = async (ctx) => {
18
+ const initialProps = await Document.getInitialProps(ctx);
19
+ return {
20
+ ...initialProps
21
+ // Styles fragment is rendered after the app and page rendering finish.
67
22
  };
68
- }();
23
+ };
24
+ export {
25
+ DigiGOVDocument as default
26
+ };
27
+ //# sourceMappingURL=Document.js.map
package/Document.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import Document from 'next/document';
3
- export declare function Fonts(): JSX.Element;
4
3
  export default class DigiGOVDocument extends Document {
5
- render(): JSX.Element;
4
+ render(): React.JSX.Element;
6
5
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Document.tsx"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport Document, { Html, Head, Main, NextScript } from 'next/document';\n\nexport default class DigiGOVDocument extends Document {\n render() {\n return (\n <Html>\n <Head>\n <script\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n`,\n }}\n ></script>\n </Head>\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\n );\n }\n}\n\nDigiGOVDocument.getInitialProps = async (ctx) => {\n // Resolution order\n //\n // On the server:\n // 1. app.getInitialProps\n // 2. page.getInitialProps\n // 3. document.getInitialProps\n // 4. app.render\n // 5. page.render\n // 6. document.render\n //\n // On the server with error:\n // 1. document.getInitialProps\n // 2. app.render\n // 3. page.render\n // 4. document.render\n //\n // On the client\n // 1. app.getInitialProps\n // 2. page.getInitialProps\n // 3. app.render\n // 4. page.render\n\n // Render app and page and get the context of the page with collected side effects.\n const initialProps = await Document.getInitialProps(ctx);\n\n return {\n ...initialProps,\n // Styles fragment is rendered after the app and page rendering finish.\n };\n};\n"],
5
+ "mappings": "AACA,OAAO,WAAW;AAClB,OAAO,YAAY,MAAM,MAAM,MAAM,kBAAkB;AAEvD,MAAO,wBAAsC,SAAS;AAAA,EACpD,SAAS;AACP,WACE,oCAAC,YACC,oCAAC,YACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA,QAEV;AAAA;AAAA,IACD,CACH,GACA,oCAAC,cACC,oCAAC,UAAK,GACN,oCAAC,gBAAW,CACd,CACF;AAAA,EAEJ;AACF;AAEA,gBAAgB,kBAAkB,OAAO,QAAQ;AAwB/C,QAAM,eAAe,MAAM,SAAS,gBAAgB,GAAG;AAEvD,SAAO;AAAA,IACL,GAAG;AAAA;AAAA,EAEL;AACF;",
6
+ "names": []
7
+ }
package/Image/index.js CHANGED
@@ -1,15 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["src"];
4
- import React from 'react';
5
- import NextImage from 'next/image';
6
- import { useBasePath } from '@digigov/nextjs/hooks';
7
- var Image = function Image(_ref) {
8
- var src = _ref.src,
9
- rest = _objectWithoutProperties(_ref, _excluded);
10
- var basePathSrc = useBasePath(src);
11
- return /*#__PURE__*/React.createElement(NextImage, _extends({
12
- src: basePathSrc
13
- }, rest));
1
+ import React from "react";
2
+ import NextImage from "next/image";
3
+ import { useBasePath } from "@digigov/nextjs/hooks";
4
+ const Image = ({ src, ...rest }) => {
5
+ const basePathSrc = useBasePath(typeof src === "string" ? src : "");
6
+ return /* @__PURE__ */ React.createElement(NextImage, { src: typeof src === "string" ? basePathSrc : src, ...rest });
14
7
  };
15
- export default Image;
8
+ var Image_default = Image;
9
+ export {
10
+ Image_default as default
11
+ };
12
+ //# sourceMappingURL=Image.js.map
package/Image.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Image.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport NextImage, { ImageProps } from 'next/image';\nimport { useBasePath } from '@digigov/nextjs/hooks';\n\nconst Image: React.FC<ImageProps> = ({ src, ...rest }) => {\n const basePathSrc = useBasePath(typeof src === 'string' ? src : '');\n return (\n <NextImage src={typeof src === 'string' ? basePathSrc : src} {...rest} />\n );\n};\n\nexport default Image;\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,eAA+B;AACtC,SAAS,mBAAmB;AAE5B,MAAM,QAA8B,CAAC,EAAE,KAAK,GAAG,KAAK,MAAM;AACxD,QAAM,cAAc,YAAY,OAAO,QAAQ,WAAW,MAAM,EAAE;AAClE,SACE,oCAAC,aAAU,KAAK,OAAO,QAAQ,WAAW,cAAc,KAAM,GAAG,MAAM;AAE3E;AAEA,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
package/Link/index.js CHANGED
@@ -1,46 +1,38 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["href"];
4
- import React, { useEffect } from 'react';
5
- import Link from 'next/link';
6
- import { useRouter } from 'next/router';
7
- import LinkBase from '@digigov/react-core/LinkBase';
8
- var NextLink = function NextLink(props, ref) {
9
- var href = props.href,
10
- other = _objectWithoutProperties(props, _excluded);
11
- var isExternalLink =
12
- //check if url has a file extension
13
- /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||
14
- // or if props has a target or rel
15
- other.target === '_blank';
16
- var router = useRouter();
17
- useEffect(function () {
18
- var path = router.asPath;
19
- if (path && path.includes('#')) {
20
- setTimeout(function () {
21
- var id = path.replace('#', '');
22
- var el = window.document.getElementById(id);
23
- var r = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
1
+ import React, { useEffect } from "react";
2
+ import Link from "next/link";
3
+ import { useRouter } from "next/router";
4
+ import { LinkBase } from "@digigov/ui/navigation/Link";
5
+ const NextLink = (props, ref) => {
6
+ const { href, ...other } = props;
7
+ const isExternalLink = (
8
+ //check if url has a file extension or starts with mailto
9
+ /^(?:[a-z]+:)?\/\/|\.pdf|\.docx?|\.xlsx?|^mailto:/i.test(href || "") || // or if props has a target or rel
10
+ other.target === "_blank"
11
+ );
12
+ const router = useRouter();
13
+ useEffect(() => {
14
+ const path = router.asPath;
15
+ if (path && path.includes("#")) {
16
+ setTimeout(() => {
17
+ const id = path.replace("#", "");
18
+ const el = window.document.getElementById(id);
19
+ const r = el?.getBoundingClientRect();
24
20
  if (r) {
25
- var _window$top;
26
- (_window$top = window.top) === null || _window$top === void 0 ? void 0 : _window$top.scroll({
21
+ window.top?.scroll({
27
22
  top: scrollY + r.top,
28
- behavior: 'smooth'
23
+ behavior: "smooth"
29
24
  });
30
25
  }
31
26
  }, 600);
32
27
  }
33
28
  }, [router.asPath]);
34
29
  if (isExternalLink) {
35
- return /*#__PURE__*/React.createElement(LinkBase, _extends({
36
- ref: ref,
37
- href: href || '#'
38
- }, other), props.children);
30
+ return /* @__PURE__ */ React.createElement(LinkBase, { ref, href: href || "#", ...other }, props.children);
39
31
  }
40
- return /*#__PURE__*/React.createElement(Link, _extends({
41
- href: href || '#'
42
- }, other), /*#__PURE__*/React.createElement(LinkBase, _extends({
43
- ref: ref
44
- }, other), props.children));
32
+ return /* @__PURE__ */ React.createElement(Link, { href: href || "#", ...other }, /* @__PURE__ */ React.createElement(LinkBase, { ref, ...other }, props.children));
45
33
  };
46
- export default /*#__PURE__*/React.forwardRef(NextLink);
34
+ var Link_default = React.forwardRef(NextLink);
35
+ export {
36
+ Link_default as default
37
+ };
38
+ //# sourceMappingURL=Link.js.map
package/Link.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { LinkProps } from '@digigov/ui/navigation/Link';
3
- declare const _default: React.ForwardRefExoticComponent<Pick<LinkProps, "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "media" | "target" | "type" | "role" | "tabIndex" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "download" | "hrefLang" | "ping" | "rel" | "referrerPolicy" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "printVisible" | "xsUpHidden" | "smUpHidden" | "mdUpHidden" | "lgUpHidden" | "xlUpHidden" | "xsHidden" | "smHidden" | "mdHidden" | "lgHidden" | "xlHidden" | "underline"> & React.RefAttributes<HTMLAnchorElement>>;
3
+ declare const _default: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
4
4
  export default _default;
package/Link.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Link.tsx"],
4
+ "sourcesContent": ["import React, { useEffect } from 'react';\nimport Link from 'next/link';\nimport { useRouter } from 'next/router';\nimport { LinkBase } from '@digigov/ui/navigation/Link';\nimport { LinkProps } from '@digigov/ui/navigation/Link';\n\nconst NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (\n props,\n ref\n) => {\n const { href, ...other } = props;\n\n const isExternalLink =\n //check if url has a file extension or starts with mailto\n /^(?:[a-z]+:)?\\/\\/|\\.pdf|\\.docx?|\\.xlsx?|^mailto:/i.test(href || '') ||\n // or if props has a target or rel\n other.target === '_blank';\n\n const router = useRouter();\n\n useEffect(() => {\n const path = router.asPath;\n if (path && path.includes('#')) {\n setTimeout(() => {\n const id = path.replace('#', '');\n const el = window.document.getElementById(id);\n const r = el?.getBoundingClientRect();\n if (r) {\n window.top?.scroll({\n top: scrollY + r.top,\n behavior: 'smooth',\n });\n }\n }, 600);\n }\n }, [router.asPath]);\n\n if (isExternalLink) {\n return (\n <LinkBase ref={ref} href={href || '#'} {...other}>\n {props.children}\n </LinkBase>\n );\n }\n\n return (\n <Link href={href || '#'} {...other}>\n <LinkBase ref={ref} {...other}>\n {props.children}\n </LinkBase>\n </Link>\n );\n};\n\nexport default React.forwardRef(NextLink);\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,iBAAiB;AACjC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAGzB,MAAM,WAAyE,CAC7E,OACA,QACG;AACH,QAAM,EAAE,MAAM,GAAG,MAAM,IAAI;AAE3B,QAAM;AAAA;AAAA,IAEJ,oDAAoD,KAAK,QAAQ,EAAE;AAAA,IAEnE,MAAM,WAAW;AAAA;AAEnB,QAAM,SAAS,UAAU;AAEzB,YAAU,MAAM;AACd,UAAM,OAAO,OAAO;AACpB,QAAI,QAAQ,KAAK,SAAS,GAAG,GAAG;AAC9B,iBAAW,MAAM;AACf,cAAM,KAAK,KAAK,QAAQ,KAAK,EAAE;AAC/B,cAAM,KAAK,OAAO,SAAS,eAAe,EAAE;AAC5C,cAAM,IAAI,IAAI,sBAAsB;AACpC,YAAI,GAAG;AACL,iBAAO,KAAK,OAAO;AAAA,YACjB,KAAK,UAAU,EAAE;AAAA,YACjB,UAAU;AAAA,UACZ,CAAC;AAAA,QACH;AAAA,MACF,GAAG,GAAG;AAAA,IACR;AAAA,EACF,GAAG,CAAC,OAAO,MAAM,CAAC;AAElB,MAAI,gBAAgB;AAClB,WACE,oCAAC,YAAS,KAAU,MAAM,QAAQ,KAAM,GAAG,SACxC,MAAM,QACT;AAAA,EAEJ;AAEA,SACE,oCAAC,QAAK,MAAM,QAAQ,KAAM,GAAG,SAC3B,oCAAC,YAAS,KAAW,GAAG,SACrB,MAAM,QACT,CACF;AAEJ;AAEA,IAAO,eAAQ,MAAM,WAAW,QAAQ;",
6
+ "names": []
7
+ }
package/cjs/App/index.js CHANGED
@@ -1,59 +1,71 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
- var _react = _interopRequireDefault(require("react"));
15
- var _app = _interopRequireDefault(require("next/app"));
16
- var _head = _interopRequireDefault(require("next/head"));
17
- var _reactI18next = require("react-i18next");
18
- var _Link = _interopRequireDefault(require("@digigov/nextjs/Link"));
19
- var _App2 = _interopRequireWildcard(require("@digigov/ui/cjs/app/App"));
20
- var _i18n = require("@digigov/ui/cjs/i18n");
21
- var _Link2 = require("@digigov/ui/cjs/navigation/Link");
22
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
24
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
25
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
26
- var _ref = /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
27
- name: "viewport",
28
- content: "minimum-scale=1, initial-scale=1, width=device-width"
29
- }));
30
- var DigiGOVNextApp = /*#__PURE__*/function (_App) {
31
- (0, _inherits2["default"])(DigiGOVNextApp, _App);
32
- function DigiGOVNextApp() {
33
- (0, _classCallCheck2["default"])(this, DigiGOVNextApp);
34
- return _callSuper(this, DigiGOVNextApp, arguments);
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
35
16
  }
36
- (0, _createClass2["default"])(DigiGOVNextApp, [{
37
- key: "render",
38
- value: function render() {
39
- var _this$props = this.props,
40
- Component = _this$props.Component,
41
- pageProps = _this$props.pageProps,
42
- _t = _this$props.t,
43
- i18n = _this$props.i18n,
44
- _this$props$ssr = _this$props.ssr,
45
- ssr = _this$props$ssr === void 0 ? false : _this$props$ssr;
46
- return /*#__PURE__*/_react["default"].createElement(_i18n.I18NProvider, {
47
- t: function t(str) {
48
- return typeof str === 'string' ? _t(str) : str;
49
- },
50
- i18n: i18n
51
- }, /*#__PURE__*/_react["default"].createElement(_Link2.LinkProvider, {
52
- component: _Link["default"]
53
- }, _ref, ssr ? /*#__PURE__*/_react["default"].createElement(_App2["default"], null, /*#__PURE__*/_react["default"].createElement(Component, pageProps)) : /*#__PURE__*/_react["default"].createElement(_App2.StaticApp, null, /*#__PURE__*/_react["default"].createElement(Component, pageProps))));
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var App_exports = {};
29
+ __export(App_exports, {
30
+ default: () => App_default
31
+ });
32
+ module.exports = __toCommonJS(App_exports);
33
+ var import_react = __toESM(require("react"));
34
+ var import_app = __toESM(require("next/app"));
35
+ var import_head = __toESM(require("next/head"));
36
+ var import_router = require("next/router");
37
+ var import_react_i18next = require("react-i18next");
38
+ var import_Link = __toESM(require("@digigov/nextjs/Link"));
39
+ var import_App = __toESM(require("@digigov/ui/app/App"));
40
+ var import_i18n = require("@digigov/ui/i18n");
41
+ var import_Link2 = require("@digigov/ui/navigation/Link");
42
+ class DigiGOVNextAppClass extends import_app.default {
43
+ render() {
44
+ const { Component, pageProps, t, i18n: i18n2, ssr = false, router } = this.props;
45
+ const { locale } = router;
46
+ if (locale && i18n2.language != locale) {
47
+ i18n2.changeLanguage(locale);
54
48
  }
55
- }]);
56
- return DigiGOVNextApp;
57
- }(_app["default"]);
58
- var DigiGOVNextAppWithTranslation = (0, _reactI18next.withTranslation)()(DigiGOVNextApp);
59
- var _default = exports["default"] = DigiGOVNextAppWithTranslation;
49
+ return /* @__PURE__ */ import_react.default.createElement(
50
+ import_i18n.I18NProvider,
51
+ {
52
+ t: (str) => typeof str === "string" ? t(str) : str,
53
+ i18n: i18n2
54
+ },
55
+ /* @__PURE__ */ import_react.default.createElement(import_Link2.LinkProvider, { component: import_Link.default }, /* @__PURE__ */ import_react.default.createElement(import_head.default, null, /* @__PURE__ */ import_react.default.createElement(
56
+ "meta",
57
+ {
58
+ name: "viewport",
59
+ content: "minimum-scale=1, initial-scale=1, width=device-width"
60
+ }
61
+ )), ssr ? /* @__PURE__ */ import_react.default.createElement(import_App.default, null, /* @__PURE__ */ import_react.default.createElement(Component, { ...pageProps })) : /* @__PURE__ */ import_react.default.createElement(import_App.StaticApp, null, /* @__PURE__ */ import_react.default.createElement(Component, { ...pageProps })))
62
+ );
63
+ }
64
+ }
65
+ const DigiGOVNextAppWithTranslation = (0, import_react_i18next.withTranslation)()(DigiGOVNextAppClass);
66
+ const DigiGOVNextApp = (props) => {
67
+ const router = (0, import_router.useRouter)();
68
+ return /* @__PURE__ */ import_react.default.createElement(DigiGOVNextAppWithTranslation, { ...props, router });
69
+ };
70
+ var App_default = DigiGOVNextApp;
71
+ //# sourceMappingURL=App.js.map
package/cjs/App.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/App.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport { i18n, TFunction } from 'i18next';\nimport App from 'next/app';\nimport Head from 'next/head';\nimport { NextRouter, useRouter } from 'next/router';\nimport { withTranslation, WithTranslation } from 'react-i18next';\nimport NextLink from '@digigov/nextjs/Link';\nimport DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';\nimport type { AppProps } from '@digigov/ui/app/App';\nimport { I18NProvider } from '@digigov/ui/i18n';\nimport { LinkProvider } from '@digigov/ui/navigation/Link';\n\nexport interface DigiGOVNextAppProps extends AppProps, WithTranslation {\n children?: React.ReactNode;\n t: TFunction;\n i18n: i18n;\n ssr: boolean;\n router: NextRouter;\n}\nclass DigiGOVNextAppClass extends App<DigiGOVNextAppProps> {\n render(): React.ReactElement {\n const { Component, pageProps, t, i18n, ssr = false, router } = this.props;\n const { locale } = router;\n\n if (locale && i18n.language != locale) {\n i18n.changeLanguage(locale);\n }\n return (\n <I18NProvider\n t={(str) => (typeof str === 'string' ? t(str) : str)}\n i18n={i18n}\n >\n <LinkProvider component={NextLink}>\n <Head>\n <meta\n name=\"viewport\"\n content=\"minimum-scale=1, initial-scale=1, width=device-width\"\n />\n </Head>\n {ssr ? (\n <DigiGOVApp>\n <Component {...pageProps} />\n </DigiGOVApp>\n ) : (\n <StaticApp>\n <Component {...pageProps} />\n </StaticApp>\n )}\n </LinkProvider>\n </I18NProvider>\n );\n }\n}\n\nconst DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextAppClass);\nconst DigiGOVNextApp = (props) => {\n const router = useRouter();\n return <DigiGOVNextAppWithTranslation {...props} router={router} />;\n};\nexport default DigiGOVNextApp;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,iBAAgB;AAChB,kBAAiB;AACjB,oBAAsC;AACtC,2BAAiD;AACjD,kBAAqB;AACrB,iBAAsC;AAEtC,kBAA6B;AAC7B,IAAAA,eAA6B;AAS7B,MAAM,4BAA4B,WAAAC,QAAyB;AAAA,EACzD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAC,OAAM,MAAM,OAAO,OAAO,IAAI,KAAK;AACpE,UAAM,EAAE,OAAO,IAAI;AAEnB,QAAI,UAAUA,MAAK,YAAY,QAAQ;AACrC,MAAAA,MAAK,eAAe,MAAM;AAAA,IAC5B;AACA,WACE,6BAAAC,QAAA;AAAA,MAAC;AAAA;AAAA,QACC,GAAG,CAAC,QAAS,OAAO,QAAQ,WAAW,EAAE,GAAG,IAAI;AAAA,QAChD,MAAMD;AAAA;AAAA,MAEN,6BAAAC,QAAA,cAAC,6BAAa,WAAW,YAAAC,WACvB,6BAAAD,QAAA,cAAC,YAAAE,SAAA,MACC,6BAAAF,QAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA;AAAA,MACV,CACF,GACC,MACC,6BAAAA,QAAA,cAAC,WAAAG,SAAA,MACC,6BAAAH,QAAA,cAAC,aAAW,GAAG,WAAW,CAC5B,IAEA,6BAAAA,QAAA,cAAC,4BACC,6BAAAA,QAAA,cAAC,aAAW,GAAG,WAAW,CAC5B,CAEJ;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,MAAM,oCAAgC,sCAAgB,EAAE,mBAAmB;AAC3E,MAAM,iBAAiB,CAAC,UAAU;AAChC,QAAM,aAAS,yBAAU;AACzB,SAAO,6BAAAA,QAAA,cAAC,iCAA+B,GAAG,OAAO,QAAgB;AACnE;AACA,IAAO,cAAQ;",
6
+ "names": ["import_Link", "App", "i18n", "React", "NextLink", "Head", "DigiGOVApp"]
7
+ }