@reykjavik/webtools 0.1.1 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
- ## 0.1.0 – 0.1.1
7
+ ## 0.1.0 – 0.1.2
8
8
 
9
9
  _2023-03-24_
10
10
 
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { Router } from 'next/router';
3
3
  import Script from 'next/script';
4
- import { useCookieHubConsent } from '../CookieHubConsent';
4
+ import { useCookieHubConsent } from '../CookieHubConsent.js';
5
5
  // END: Mock typing of SiteImprove's event tracking API
6
6
  // --------------------------------------------------------------------------
7
7
  //
@@ -3,9 +3,9 @@ import React, { FunctionComponent } from 'react';
3
3
  import { Cleanup } from '@reykjavik/hanna-utils';
4
4
  import { ServerResponse } from 'http';
5
5
  import type { AppType } from 'next/app';
6
- import type { HTTP_418_ImATeapot, HTTP_ERROR, TTLConfig } from '../http';
6
+ import type { HTTP_418_ImATeapot, HTTP_ERROR, TTLConfig } from '../http.js';
7
7
  type HTTP_ERROR_all = HTTP_ERROR | typeof HTTP_418_ImATeapot;
8
- export * from '../http';
8
+ export * from '../http.js';
9
9
  type NextContextLike = {
10
10
  res: ServerResponse;
11
11
  };
@@ -33,10 +33,10 @@ export declare const makeErrorizeAppHOC: <EP extends Partial<ErrorProps>>(ErrorP
33
33
  <P extends {
34
34
  [key: string]: unknown;
35
35
  __error?: undefined;
36
- }>(App: AppType<P>): React.FunctionComponent<import("next/dist/shared/lib/utils").AppPropsType<any, P | ({
36
+ }>(App: AppType<P>): React.FunctionComponent<import("next/dist/shared/lib/utils.js").AppPropsType<any, P | ({
37
37
  __error: ErrorProps;
38
38
  } & Omit<ErrorProps & EP, keyof ErrorProps>)>> & {
39
- getInitialProps?(context: import("next/dist/shared/lib/utils").AppContextType<import("next/router").NextRouter>): P | ({
39
+ getInitialProps?(context: import("next/dist/shared/lib/utils.js").AppContextType<import("next/router.js").NextRouter>): P | ({
40
40
  __error: ErrorProps;
41
41
  } & Omit<ErrorProps & EP, keyof ErrorProps>) | Promise<P | ({
42
42
  __error: ErrorProps;
package/esm/next/http.js CHANGED
@@ -10,12 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React from 'react';
13
- import { cacheControl, HTTP_304_NotModified } from '../http';
13
+ import { cacheControl, HTTP_304_NotModified } from '../http.js';
14
14
  /*
15
15
  Re-export all of the base [http module](#reykjavikwebtoolshttp)'s exports,
16
16
  purely for convenience.
17
17
  */
18
- export * from '../http';
18
+ export * from '../http.js';
19
19
  /**
20
20
  * Use this method inside a `getServerSideProps` method (or API route)
21
21
  * to return an error page with proper HTTP status code and all the shit.
@@ -30,7 +30,7 @@ exports.pingSiteImprove = exports.SiteImprove = void 0;
30
30
  const react_1 = __importStar(require("react"));
31
31
  const router_1 = require("next/router");
32
32
  const script_1 = __importDefault(require("next/script"));
33
- const CookieHubConsent_1 = require("../CookieHubConsent");
33
+ const CookieHubConsent_js_1 = require("../CookieHubConsent.js");
34
34
  // END: Mock typing of SiteImprove's event tracking API
35
35
  // --------------------------------------------------------------------------
36
36
  //
@@ -83,7 +83,7 @@ const scriptUrlTemplate = `https://siteimproveanalytics.com/js/siteanalyze_${idT
83
83
  * @see https://github.com/reykjavikcity/webtools/tree/v0.1##siteimprove-component
84
84
  */
85
85
  const SiteImprove = (props) => {
86
- const { analytics } = (0, CookieHubConsent_1.useCookieHubConsent)();
86
+ const { analytics } = (0, CookieHubConsent_js_1.useCookieHubConsent)();
87
87
  const consented = (analytics && props.hasConstented !== false) ||
88
88
  (analytics === undefined && props.hasConstented);
89
89
  (0, react_1.useEffect)(() => {
package/next/http.d.ts CHANGED
@@ -3,9 +3,9 @@ import React, { FunctionComponent } from 'react';
3
3
  import { Cleanup } from '@reykjavik/hanna-utils';
4
4
  import { ServerResponse } from 'http';
5
5
  import type { AppType } from 'next/app';
6
- import type { HTTP_418_ImATeapot, HTTP_ERROR, TTLConfig } from '../http';
6
+ import type { HTTP_418_ImATeapot, HTTP_ERROR, TTLConfig } from '../http.js';
7
7
  type HTTP_ERROR_all = HTTP_ERROR | typeof HTTP_418_ImATeapot;
8
- export * from '../http';
8
+ export * from '../http.js';
9
9
  type NextContextLike = {
10
10
  res: ServerResponse;
11
11
  };
@@ -33,10 +33,10 @@ export declare const makeErrorizeAppHOC: <EP extends Partial<ErrorProps>>(ErrorP
33
33
  <P extends {
34
34
  [key: string]: unknown;
35
35
  __error?: undefined;
36
- }>(App: AppType<P>): React.FunctionComponent<import("next/dist/shared/lib/utils").AppPropsType<any, P | ({
36
+ }>(App: AppType<P>): React.FunctionComponent<import("next/dist/shared/lib/utils.js").AppPropsType<any, P | ({
37
37
  __error: ErrorProps;
38
38
  } & Omit<ErrorProps & EP, keyof ErrorProps>)>> & {
39
- getInitialProps?(context: import("next/dist/shared/lib/utils").AppContextType<import("next/router").NextRouter>): P | ({
39
+ getInitialProps?(context: import("next/dist/shared/lib/utils.js").AppContextType<import("next/router.js").NextRouter>): P | ({
40
40
  __error: ErrorProps;
41
41
  } & Omit<ErrorProps & EP, keyof ErrorProps>) | Promise<P | ({
42
42
  __error: ErrorProps;
package/next/http.js CHANGED
@@ -30,12 +30,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.notModified304 = exports.makeErrorizeAppHOC = void 0;
32
32
  const react_1 = __importDefault(require("react"));
33
- const http_1 = require("../http");
33
+ const http_js_1 = require("../http.js");
34
34
  /*
35
35
  Re-export all of the base [http module](#reykjavikwebtoolshttp)'s exports,
36
36
  purely for convenience.
37
37
  */
38
- __exportStar(require("../http"), exports);
38
+ __exportStar(require("../http.js"), exports);
39
39
  /**
40
40
  * Use this method inside a `getServerSideProps` method (or API route)
41
41
  * to return an error page with proper HTTP status code and all the shit.
@@ -50,7 +50,7 @@ const showErrorPage = (response, error, ttl = '2s') => {
50
50
  const { statusCode, message } = error, otherProps = __rest(error, ["statusCode", "message"]);
51
51
  response = 'res' in response ? response.res : response;
52
52
  response.statusCode = error.statusCode;
53
- (0, http_1.cacheControl)(response, ttl);
53
+ (0, http_js_1.cacheControl)(response, ttl);
54
54
  return {
55
55
  props: Object.assign(Object.assign({}, otherProps), { __error: { statusCode, message } }),
56
56
  };
@@ -92,7 +92,7 @@ exports.makeErrorizeAppHOC = makeErrorizeAppHOC;
92
92
  */
93
93
  const notModified304 = (response) => {
94
94
  response = 'res' in response ? response.res : response;
95
- response.statusCode = http_1.HTTP_304_NotModified;
95
+ response.statusCode = http_js_1.HTTP_304_NotModified;
96
96
  return {
97
97
  props:
98
98
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/webtools",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Misc. JS/TS helpers used by Reykjavík City's web dev teams.",
5
5
  "main": "index.js",
6
6
  "repository": "ssh://git@github.com:reykjavikcity/webtools.git",