@newskit-render/standalone-components 0.26.0 → 0.27.0-alpha.0
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/dist/cjs/config/index.d.ts +2 -1
- package/dist/cjs/config/index.js +7 -4
- package/dist/cjs/config/index.js.map +1 -1
- package/dist/cjs/help-hub/components/ContentListView/ContentListView.d.ts +2 -1
- package/dist/cjs/help-hub/components/ContentListView/ContentListView.js +3 -4
- package/dist/cjs/help-hub/components/ContentListView/ContentListView.js.map +1 -1
- package/dist/cjs/help-hub/components/SearchBar/SearchBar.js +2 -2
- package/dist/cjs/help-hub/components/SearchBar/SearchBar.js.map +1 -1
- package/dist/cjs/help-hub/components/SearchBar/components/Autocomplete.d.ts +2 -4
- package/dist/cjs/help-hub/components/SearchBar/components/Autocomplete.js +18 -17
- package/dist/cjs/help-hub/components/SearchBar/components/Autocomplete.js.map +1 -1
- package/dist/cjs/help-hub/components/SearchBar/types.d.ts +0 -2
- package/dist/cjs/help-hub/components/Templates/LayoutTemplate.d.ts +6 -0
- package/dist/cjs/help-hub/components/Templates/LayoutTemplate.js +4 -3
- package/dist/cjs/help-hub/components/Templates/LayoutTemplate.js.map +1 -1
- package/dist/cjs/help-hub/context/baseContext.js +14 -8
- package/dist/cjs/help-hub/context/baseContext.js.map +1 -1
- package/dist/cjs/help-hub/context/types.d.ts +21 -1
- package/dist/cjs/help-hub/context/types.js.map +1 -1
- package/dist/cjs/help-hub/index.d.ts +1 -0
- package/dist/cjs/help-hub/index.js +1 -0
- package/dist/cjs/help-hub/index.js.map +1 -1
- package/dist/cjs/help-hub/pages/ArticlePage.d.ts +3 -4
- package/dist/cjs/help-hub/pages/ArticlePage.js +29 -15
- package/dist/cjs/help-hub/pages/ArticlePage.js.map +1 -1
- package/dist/cjs/help-hub/pages/LandingPage.js +12 -11
- package/dist/cjs/help-hub/pages/LandingPage.js.map +1 -1
- package/dist/cjs/help-hub/pages/ResultsPage.d.ts +2 -2
- package/dist/cjs/help-hub/pages/ResultsPage.js +32 -91
- package/dist/cjs/help-hub/pages/ResultsPage.js.map +1 -1
- package/dist/cjs/help-hub/pages/types.d.ts +8 -1
- package/dist/cjs/help-hub/provider/CredentialsProvider.d.ts +7 -0
- package/dist/cjs/help-hub/provider/CredentialsProvider.js +38 -0
- package/dist/cjs/help-hub/provider/CredentialsProvider.js.map +1 -0
- package/dist/cjs/help-hub/provider/articleProvider.d.ts +20 -0
- package/dist/cjs/help-hub/provider/articleProvider.js +90 -0
- package/dist/cjs/help-hub/provider/articleProvider.js.map +1 -0
- package/dist/cjs/help-hub/provider/getHelpHubConfig.d.ts +2 -0
- package/dist/cjs/help-hub/provider/getHelpHubConfig.js +17 -0
- package/dist/cjs/help-hub/provider/getHelpHubConfig.js.map +1 -0
- package/dist/cjs/help-hub/provider/index.d.ts +4 -0
- package/dist/cjs/help-hub/provider/index.js +17 -0
- package/dist/cjs/help-hub/provider/index.js.map +1 -0
- package/dist/cjs/help-hub/provider/resultsProvider.d.ts +19 -0
- package/dist/cjs/help-hub/provider/resultsProvider.js +90 -0
- package/dist/cjs/help-hub/provider/resultsProvider.js.map +1 -0
- package/dist/cjs/help-hub/provider/types.d.ts +26 -0
- package/dist/cjs/help-hub/provider/types.js +13 -0
- package/dist/cjs/help-hub/provider/types.js.map +1 -0
- package/dist/cjs/help-hub/test-helpers/articlePageContextOptionsMock.d.ts +2 -0
- package/dist/cjs/help-hub/test-helpers/articlePageContextOptionsMock.js +17 -0
- package/dist/cjs/help-hub/test-helpers/articlePageContextOptionsMock.js.map +1 -0
- package/dist/cjs/help-hub/test-helpers/index.d.ts +2 -0
- package/dist/cjs/help-hub/test-helpers/index.js +9 -0
- package/dist/cjs/help-hub/test-helpers/index.js.map +1 -0
- package/dist/cjs/help-hub/test-helpers/landingPageContextOptionsMock.d.ts +2 -0
- package/dist/cjs/help-hub/test-helpers/landingPageContextOptionsMock.js +25 -0
- package/dist/cjs/help-hub/test-helpers/landingPageContextOptionsMock.js.map +1 -0
- package/dist/cjs/help-hub/test-helpers/mocks.d.ts +6 -0
- package/dist/cjs/help-hub/test-helpers/mocks.js +14 -0
- package/dist/cjs/help-hub/test-helpers/mocks.js.map +1 -0
- package/dist/cjs/help-hub/test-helpers/resultsPageContextOptionsMock.d.ts +2 -0
- package/dist/cjs/help-hub/test-helpers/resultsPageContextOptionsMock.js +20 -0
- package/dist/cjs/help-hub/test-helpers/resultsPageContextOptionsMock.js.map +1 -0
- package/dist/cjs/help-hub/test-helpers/sharedMocks.d.ts +5 -0
- package/dist/cjs/help-hub/test-helpers/sharedMocks.js +31 -0
- package/dist/cjs/help-hub/test-helpers/sharedMocks.js.map +1 -0
- package/dist/cjs/help-hub/types/index.d.ts +2 -3
- package/dist/cjs/helpers/testHelpers.d.ts +4 -0
- package/dist/cjs/helpers/testHelpers.js +14 -1
- package/dist/cjs/helpers/testHelpers.js.map +1 -1
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.js +7 -4
- package/dist/config/index.js.map +1 -1
- package/dist/help-hub/components/ContentListView/ContentListView.d.ts +2 -1
- package/dist/help-hub/components/ContentListView/ContentListView.js +3 -4
- package/dist/help-hub/components/ContentListView/ContentListView.js.map +1 -1
- package/dist/help-hub/components/SearchBar/SearchBar.js +2 -2
- package/dist/help-hub/components/SearchBar/SearchBar.js.map +1 -1
- package/dist/help-hub/components/SearchBar/components/Autocomplete.d.ts +2 -4
- package/dist/help-hub/components/SearchBar/components/Autocomplete.js +18 -17
- package/dist/help-hub/components/SearchBar/components/Autocomplete.js.map +1 -1
- package/dist/help-hub/components/SearchBar/types.d.ts +0 -2
- package/dist/help-hub/components/Templates/LayoutTemplate.d.ts +6 -0
- package/dist/help-hub/components/Templates/LayoutTemplate.js +4 -3
- package/dist/help-hub/components/Templates/LayoutTemplate.js.map +1 -1
- package/dist/help-hub/context/baseContext.js +14 -8
- package/dist/help-hub/context/baseContext.js.map +1 -1
- package/dist/help-hub/context/types.d.ts +21 -1
- package/dist/help-hub/context/types.js.map +1 -1
- package/dist/help-hub/index.d.ts +1 -0
- package/dist/help-hub/index.js +1 -0
- package/dist/help-hub/index.js.map +1 -1
- package/dist/help-hub/pages/ArticlePage.d.ts +3 -4
- package/dist/help-hub/pages/ArticlePage.js +29 -15
- package/dist/help-hub/pages/ArticlePage.js.map +1 -1
- package/dist/help-hub/pages/LandingPage.js +12 -11
- package/dist/help-hub/pages/LandingPage.js.map +1 -1
- package/dist/help-hub/pages/ResultsPage.d.ts +2 -2
- package/dist/help-hub/pages/ResultsPage.js +32 -91
- package/dist/help-hub/pages/ResultsPage.js.map +1 -1
- package/dist/help-hub/pages/types.d.ts +8 -1
- package/dist/help-hub/provider/CredentialsProvider.d.ts +7 -0
- package/dist/help-hub/provider/CredentialsProvider.js +38 -0
- package/dist/help-hub/provider/CredentialsProvider.js.map +1 -0
- package/dist/help-hub/provider/articleProvider.d.ts +20 -0
- package/dist/help-hub/provider/articleProvider.js +90 -0
- package/dist/help-hub/provider/articleProvider.js.map +1 -0
- package/dist/help-hub/provider/getHelpHubConfig.d.ts +2 -0
- package/dist/help-hub/provider/getHelpHubConfig.js +17 -0
- package/dist/help-hub/provider/getHelpHubConfig.js.map +1 -0
- package/dist/help-hub/provider/index.d.ts +4 -0
- package/dist/help-hub/provider/index.js +17 -0
- package/dist/help-hub/provider/index.js.map +1 -0
- package/dist/help-hub/provider/resultsProvider.d.ts +19 -0
- package/dist/help-hub/provider/resultsProvider.js +90 -0
- package/dist/help-hub/provider/resultsProvider.js.map +1 -0
- package/dist/help-hub/provider/types.d.ts +26 -0
- package/dist/help-hub/provider/types.js +13 -0
- package/dist/help-hub/provider/types.js.map +1 -0
- package/dist/help-hub/test-helpers/articlePageContextOptionsMock.d.ts +2 -0
- package/dist/help-hub/test-helpers/articlePageContextOptionsMock.js +17 -0
- package/dist/help-hub/test-helpers/articlePageContextOptionsMock.js.map +1 -0
- package/dist/help-hub/test-helpers/index.d.ts +2 -0
- package/dist/help-hub/test-helpers/index.js +9 -0
- package/dist/help-hub/test-helpers/index.js.map +1 -0
- package/dist/help-hub/test-helpers/landingPageContextOptionsMock.d.ts +2 -0
- package/dist/help-hub/test-helpers/landingPageContextOptionsMock.js +25 -0
- package/dist/help-hub/test-helpers/landingPageContextOptionsMock.js.map +1 -0
- package/dist/help-hub/test-helpers/mocks.d.ts +6 -0
- package/dist/help-hub/test-helpers/mocks.js +14 -0
- package/dist/help-hub/test-helpers/mocks.js.map +1 -0
- package/dist/help-hub/test-helpers/resultsPageContextOptionsMock.d.ts +2 -0
- package/dist/help-hub/test-helpers/resultsPageContextOptionsMock.js +20 -0
- package/dist/help-hub/test-helpers/resultsPageContextOptionsMock.js.map +1 -0
- package/dist/help-hub/test-helpers/sharedMocks.d.ts +5 -0
- package/dist/help-hub/test-helpers/sharedMocks.js +31 -0
- package/dist/help-hub/test-helpers/sharedMocks.js.map +1 -0
- package/dist/help-hub/types/index.d.ts +2 -3
- package/dist/helpers/testHelpers.d.ts +4 -0
- package/dist/helpers/testHelpers.js +14 -1
- package/dist/helpers/testHelpers.js.map +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.resultsProvider = void 0;
|
|
54
|
+
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
55
|
+
var config_1 = require("../../config");
|
|
56
|
+
var types_1 = require("./types");
|
|
57
|
+
var getHelpHubConfig_1 = require("./getHelpHubConfig");
|
|
58
|
+
var resultsProvider = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
59
|
+
var q, credentials, promiseResult, providerProps;
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
switch (_a.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
q = context.query.q;
|
|
64
|
+
credentials = {
|
|
65
|
+
appId: config_1.algoliaAppId,
|
|
66
|
+
apiKey: config_1.algoliaApiKey,
|
|
67
|
+
indexName: config_1.algoliaIndex,
|
|
68
|
+
};
|
|
69
|
+
return [4 /*yield*/, (0, cross_fetch_1.default)(config_1.algoliaUrl + "/query", __assign(__assign({}, (0, getHelpHubConfig_1.getHelpHubConfig)(types_1.ReqMethod.POST)), { body: JSON.stringify({ params: "query=" + q }) }))];
|
|
70
|
+
case 1:
|
|
71
|
+
promiseResult = _a.sent();
|
|
72
|
+
if (promiseResult.status >= 400) {
|
|
73
|
+
console.error('Error in fetching help-hub results page');
|
|
74
|
+
return [2 /*return*/, {
|
|
75
|
+
props: {
|
|
76
|
+
credentials: credentials,
|
|
77
|
+
},
|
|
78
|
+
}];
|
|
79
|
+
}
|
|
80
|
+
return [4 /*yield*/, promiseResult.json()];
|
|
81
|
+
case 2:
|
|
82
|
+
providerProps = (_a.sent());
|
|
83
|
+
return [2 /*return*/, {
|
|
84
|
+
props: __assign(__assign({}, providerProps), { credentials: credentials }),
|
|
85
|
+
}];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}); };
|
|
89
|
+
exports.resultsProvider = resultsProvider;
|
|
90
|
+
//# sourceMappingURL=resultsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultsProvider.js","sourceRoot":"","sources":["../../../src/help-hub/provider/resultsProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA+B;AAC/B,uCAKqB;AAErB,iCAA+E;AAC/E,uDAAqD;AAE9C,IAAM,eAAe,GAAG,UAAO,OAA6B;;;;;gBAEtD,CAAC,GACR,OAAO,QADC,CACD;gBAEL,WAAW,GAAG;oBAClB,KAAK,EAAE,qBAAY;oBACnB,MAAM,EAAE,sBAAa;oBACrB,SAAS,EAAE,qBAAY;iBACxB,CAAA;gBAEqB,qBAAM,IAAA,qBAAK,EAAI,mBAAU,WAAQ,wBAClD,IAAA,mCAAgB,EAAC,iBAAS,CAAC,IAAI,CAAC,KACnC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,WAAS,CAAG,EAAE,CAAC,IAC9C,EAAA;;gBAHI,aAAa,GAAG,SAGpB;gBAEF,IAAI,aAAa,CAAC,MAAM,IAAI,GAAG,EAAE;oBAC/B,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAA;oBACxD,sBAAO;4BACL,KAAK,EAAE;gCACL,WAAW,aAAA;6BACZ;yBACF,EAAA;iBACF;gBACsB,qBAAM,aAAa,CAAC,IAAI,EAAE,EAAA;;gBAA3C,aAAa,GAAG,CAAC,SAA0B,CAAyB;gBAE1E,sBAAO;wBACL,KAAK,wBACA,aAAa,KAChB,WAAW,aAAA,GACZ;qBACF,EAAA;;;KACF,CAAA;AAhCY,QAAA,eAAe,mBAgC3B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Hit } from 'help-hub/types';
|
|
2
|
+
export declare enum ReqMethod {
|
|
3
|
+
GET = "GET",
|
|
4
|
+
POST = "POST"
|
|
5
|
+
}
|
|
6
|
+
export interface ArticleProviderProps {
|
|
7
|
+
title: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ResultsProviderProps {
|
|
11
|
+
hits: Hit[];
|
|
12
|
+
}
|
|
13
|
+
export interface ReqParams {
|
|
14
|
+
method: ReqMethod;
|
|
15
|
+
headers: Record<string, string>;
|
|
16
|
+
body?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ArticleServerContext {
|
|
19
|
+
params: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export interface ResultsServerContext {
|
|
22
|
+
query: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
export declare enum ProviderPropsMapper {
|
|
25
|
+
ArticlePageProvider = "ArticlePageProvider"
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderPropsMapper = exports.ReqMethod = void 0;
|
|
4
|
+
var ReqMethod;
|
|
5
|
+
(function (ReqMethod) {
|
|
6
|
+
ReqMethod["GET"] = "GET";
|
|
7
|
+
ReqMethod["POST"] = "POST";
|
|
8
|
+
})(ReqMethod = exports.ReqMethod || (exports.ReqMethod = {}));
|
|
9
|
+
var ProviderPropsMapper;
|
|
10
|
+
(function (ProviderPropsMapper) {
|
|
11
|
+
ProviderPropsMapper["ArticlePageProvider"] = "ArticlePageProvider";
|
|
12
|
+
})(ProviderPropsMapper = exports.ProviderPropsMapper || (exports.ProviderPropsMapper = {}));
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/help-hub/provider/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB;AAyBD,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC7B,kEAA2C,CAAA;AAC7C,CAAC,EAFW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAE9B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.articlePageContextMock = void 0;
|
|
15
|
+
var context_1 = require("../context");
|
|
16
|
+
exports.articlePageContextMock = __assign(__assign({}, context_1.baseContext), { title: 'Header title in Help Hub Article page', content: 'Header description in Help Hub Article page', credentials: { appId: '', apiKey: '', indexName: '' } });
|
|
17
|
+
//# sourceMappingURL=articlePageContextOptionsMock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articlePageContextOptionsMock.js","sourceRoot":"","sources":["../../../src/help-hub/test-helpers/articlePageContextOptionsMock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sCAAwC;AAG3B,QAAA,sBAAsB,yBAC9B,qBAAW,KACd,KAAK,EAAE,uCAAuC,EAC9C,OAAO,EAAE,6CAA6C,EACtD,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,IACtD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mockMap = void 0;
|
|
7
|
+
var mocks_1 = __importDefault(require("./mocks"));
|
|
8
|
+
exports.mockMap = mocks_1.default;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/help-hub/test-helpers/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6B;AAEpB,kBAFF,eAAO,CAEE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.landingPageContextMock = void 0;
|
|
15
|
+
var context_1 = require("../context");
|
|
16
|
+
var sharedMocks_1 = require("./sharedMocks");
|
|
17
|
+
exports.landingPageContextMock = __assign(__assign({}, context_1.baseContext), { header: {
|
|
18
|
+
title: 'Header title in Help Hub Landing page',
|
|
19
|
+
description: 'Header description in Help Hub Landing page',
|
|
20
|
+
}, contentViewList: {
|
|
21
|
+
introduction: {
|
|
22
|
+
title: 'Content list title in Help Hub Landing page',
|
|
23
|
+
},
|
|
24
|
+
}, mostReadArticles: sharedMocks_1.algoliaDataMock });
|
|
25
|
+
//# sourceMappingURL=landingPageContextOptionsMock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"landingPageContextOptionsMock.js","sourceRoot":"","sources":["../../../src/help-hub/test-helpers/landingPageContextOptionsMock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sCAAwC;AAExC,6CAA+C;AAElC,QAAA,sBAAsB,yBAC9B,qBAAW,KACd,MAAM,EAAE;QACN,KAAK,EAAE,uCAAuC;QAC9C,WAAW,EAAE,6CAA6C;KAC3D,EACD,eAAe,EAAE;QACf,YAAY,EAAE;YACZ,KAAK,EAAE,6CAA6C;SACrD;KACF,EACD,gBAAgB,EAAE,6BAAe,IAClC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var types_1 = require("../context/types");
|
|
5
|
+
var articlePageContextOptionsMock_1 = require("./articlePageContextOptionsMock");
|
|
6
|
+
var landingPageContextOptionsMock_1 = require("./landingPageContextOptionsMock");
|
|
7
|
+
var resultsPageContextOptionsMock_1 = require("./resultsPageContextOptionsMock");
|
|
8
|
+
var mockMap = (_a = {},
|
|
9
|
+
_a[types_1.ContextName.landingPage] = landingPageContextOptionsMock_1.landingPageContextMock,
|
|
10
|
+
_a[types_1.ContextName.resultsPage] = resultsPageContextOptionsMock_1.resultsPageContextMock,
|
|
11
|
+
_a[types_1.ContextName.articlePage] = articlePageContextOptionsMock_1.articlePageContextMock,
|
|
12
|
+
_a);
|
|
13
|
+
exports.default = mockMap;
|
|
14
|
+
//# sourceMappingURL=mocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../src/help-hub/test-helpers/mocks.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AAC9C,iFAAwE;AACxE,iFAAwE;AACxE,iFAAwE;AAExE,IAAM,OAAO;IACX,GAAC,mBAAW,CAAC,WAAW,IAAG,sDAAsB;IACjD,GAAC,mBAAW,CAAC,WAAW,IAAG,sDAAsB;IACjD,GAAC,mBAAW,CAAC,WAAW,IAAG,sDAAsB;OAClD,CAAA;AACD,kBAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.resultsPageContextMock = void 0;
|
|
15
|
+
var context_1 = require("../context");
|
|
16
|
+
exports.resultsPageContextMock = __assign(__assign({}, context_1.baseContext), { header: {
|
|
17
|
+
title: 'Header title in Help Hub Results page',
|
|
18
|
+
description: 'Header description in Help Hub Results page',
|
|
19
|
+
} });
|
|
20
|
+
//# sourceMappingURL=resultsPageContextOptionsMock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultsPageContextOptionsMock.js","sourceRoot":"","sources":["../../../src/help-hub/test-helpers/resultsPageContextOptionsMock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sCAAwC;AAG3B,QAAA,sBAAsB,yBAC9B,qBAAW,KACd,MAAM,EAAE;QACN,KAAK,EAAE,uCAAuC;QAC9C,WAAW,EAAE,6CAA6C;KAC3D,IACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.algoliaDataMock = void 0;
|
|
4
|
+
exports.algoliaDataMock = [
|
|
5
|
+
{
|
|
6
|
+
title: "What's in the smartphone app and how do I access it?",
|
|
7
|
+
content: '<ul><li>Enjoy The Times and The Sunday Times journalism wherever you are with one app, 7 days a week.</li><li>Get the latest global, business, politics, sport and finance headline news articles on the go as well as trusted analysis and opinion from our award-winning columnists and global correspondents.</li><li>On top of that, enjoy stunning picture galleries, interactive crossword puzzles and exclusive video dispatches from Great Britain and across the world. Now with a seamless link to The Times and Sunday Times Sport app.</li><li>Keep updated on all your Times+ membership offers and experience a selection of the best Times+ Talks right from within the app. </li><li>You can save your favourite articles for reading later and share your favourite stories from our Times & Sunday Times columnists from across all sections including headline news reports, UK and global business, finance, world, sport reports, politics and opinion.</li></ul>\n<br>The app is available from the <a href="https://play.google.com/store/apps/details?id=uk.co.thetimes" target="_blank">Google Play Store</a> and <a href="https://itunes.apple.com/gb/app/the-times-the-sunday-times/id436792321?mt=8" target="_blank">iTunes</a><br>Please ensure that you are using the latest Android or IOS software when downloading the app.',
|
|
8
|
+
objectID: 'what-s-in-the-smartphone-app-and-how-do-i-access-it',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
title: 'Sign-in with Google',
|
|
12
|
+
content: '<p>To use Google Sign In with The Times and Sunday Times, you must have a Google account. If you don’t have a Google account but would like to use this feature, you can easily create one at google.com<br><br><b>I see an error telling me I don’t have an account with The Times when login in to My Times account with Google Sign in?</b></p>\n\n<ul><li>\n\t<p>On first use of Google Sign In, your Times username must match the email address on your Google account, otherwise we cannot match them. If you would like to use Google Sign In but your email address does not match, you can log in using your Times email address and password and update your email address in My Account.</p>\n\t</li></ul>\n\n<p><b>Can I change my Times email address after I use Google Sign In?</b></p>\n\n<ul><li>\n\t<p>First time you sign into your Times account your login email address needs to be the same as your Google account email address. Once logged in you can update this via My Account.</p>\n\t</li></ul>\n\n<p><b>Can I still login with my own Times username and password after I use Google Sign In?</b></p>\n\n<ul><li>\n\t<p>As an existing Times user, you continue to have the ability to login using your Times username and password. You will as such retain the ability to change your password at any time.</p>\n\t</li></ul>',
|
|
13
|
+
objectID: 'sign-with-google',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
title: 'I am trying to share an article via Google+ but an error message keeps appearing',
|
|
17
|
+
content: 'This may be happening because there's an authentication issue with your Google+ account. To fix this, delete The Times and The Sunday Times app and then reinstall it. ',
|
|
18
|
+
objectID: 'i-am-trying-to-share-an-article-via-google-but-an-error-message-keeps-appearing',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: 'How will I find out if I have won a competition?',
|
|
22
|
+
content: 'Our competitions team contact the winners of our competitions via the phone number on your Times account.<br><br>If you don’t answer they will endeavor to contact you via email, giving you plenty of time to respond before finding a new winner.',
|
|
23
|
+
objectID: 'how-will-i-find-out-if-i-have-won-a-competition',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: 'How many articles can I read with my registered access?',
|
|
27
|
+
content: 'You can read up to two articles a week, Monday to Sunday. Every Monday your allocation will be reset to two articles. An article is a whole photo gallery, story or a piece of video content.',
|
|
28
|
+
objectID: 'how-many-articles-can-i-read-with-my-registered-access',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
//# sourceMappingURL=sharedMocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedMocks.js","sourceRoot":"","sources":["../../../src/help-hub/test-helpers/sharedMocks.tsx"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG;IAC7B;QACE,KAAK,EAAE,sDAAsD;QAC7D,OAAO,EACL,kyCAAkyC;QACpyC,QAAQ,EAAE,qDAAqD;KAChE;IACD;QACE,KAAK,EAAE,qBAAqB;QAC5B,OAAO,EACL,kyCAAkyC;QACpyC,QAAQ,EAAE,kBAAkB;KAC7B;IACD;QACE,KAAK,EACH,kFAAkF;QACpF,OAAO,EACL,6KAA6K;QAC/K,QAAQ,EACN,iFAAiF;KACpF;IACD;QACE,KAAK,EAAE,kDAAkD;QACzD,OAAO,EACL,qPAAqP;QACvP,QAAQ,EAAE,iDAAiD;KAC5D;IACD;QACE,KAAK,EAAE,yDAAyD;QAChE,OAAO,EACL,+LAA+L;QACjM,QAAQ,EAAE,wDAAwD;KACnE;CACF,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Hit } from '@algolia/client-search';
|
|
2
|
-
export declare type
|
|
1
|
+
import { Hit as AlgoliaHit } from '@algolia/client-search';
|
|
2
|
+
export declare type Hit = AlgoliaHit<{
|
|
3
3
|
title: string;
|
|
4
4
|
objectID: string;
|
|
5
|
-
url: string;
|
|
6
5
|
content: string;
|
|
7
6
|
}>;
|
|
8
7
|
export declare type AlgoliaCredentials = {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RenderOptions } from '@testing-library/react';
|
|
3
3
|
import { UncompiledTheme } from 'newskit';
|
|
4
|
+
import { ContextName, ContextOptions } from '../help-hub/context';
|
|
4
5
|
export declare const renderWithThemeTsl: <T extends {}>(Component: React.ComponentType<T>, props?: (T & {
|
|
5
6
|
children?: React.ReactNode;
|
|
6
7
|
}) | undefined, theme?: UncompiledTheme, options?: Omit<RenderOptions<typeof import("@testing-library/dom/types/queries"), HTMLElement>, "wrapper"> | undefined) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement>;
|
|
8
|
+
export declare const renderWithContextTsl: <T extends {}>(Component: React.ComponentType<T>, contextName: ContextName, context: Partial<ContextOptions>, props?: (T & {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}) | undefined, options?: Omit<RenderOptions<typeof import("@testing-library/dom/types/queries"), HTMLElement>, "wrapper"> | undefined) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement>;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.renderWithThemeTsl = void 0;
|
|
17
|
+
exports.renderWithContextTsl = exports.renderWithThemeTsl = void 0;
|
|
18
18
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types */
|
|
19
19
|
/** Added as described in Jest docs: https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
|
20
20
|
* Needed because at least one component uses <MediaQueryProvider> from newskit, which uses window.matchmedia
|
|
@@ -33,8 +33,12 @@ Object.defineProperty(window, 'matchMedia', {
|
|
|
33
33
|
}); }),
|
|
34
34
|
});
|
|
35
35
|
var react_1 = __importDefault(require("react"));
|
|
36
|
+
var lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
36
37
|
var react_2 = require("@testing-library/react");
|
|
37
38
|
var newskit_1 = require("newskit");
|
|
39
|
+
var context_1 = require("../help-hub/context");
|
|
40
|
+
var shared_components_1 = require("@newskit-render/shared-components");
|
|
41
|
+
var test_helpers_1 = require("../help-hub/test-helpers");
|
|
38
42
|
var renderWithThemeTsl = function (Component, props, theme, options) {
|
|
39
43
|
if (theme === void 0) { theme = newskit_1.newskitLightTheme; }
|
|
40
44
|
return (0, react_2.render)(react_1.default.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
|
|
@@ -43,4 +47,13 @@ var renderWithThemeTsl = function (Component, props, theme, options) {
|
|
|
43
47
|
} }));
|
|
44
48
|
};
|
|
45
49
|
exports.renderWithThemeTsl = renderWithThemeTsl;
|
|
50
|
+
var renderWithContextTsl = function (Component, contextName, context, props, options) {
|
|
51
|
+
var mergedContext = (0, lodash_merge_1.default)({}, test_helpers_1.mockMap[contextName], context);
|
|
52
|
+
return (0, react_2.render)(react_1.default.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
|
|
53
|
+
var children = _a.children;
|
|
54
|
+
return (react_1.default.createElement(context_1.HelpHubContextProvider, { context: mergedContext, contextName: contextName },
|
|
55
|
+
react_1.default.createElement(newskit_1.ThemeProvider, { theme: shared_components_1.sharedTheme }, children)));
|
|
56
|
+
} }));
|
|
57
|
+
};
|
|
58
|
+
exports.renderWithContextTsl = renderWithContextTsl;
|
|
46
59
|
//# sourceMappingURL=testHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../src/helpers/testHelpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oGAAoG;AACpG;;GAEG;AACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;IAC1C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;KACzB,CAAC,EAT6C,CAS7C,CAAC;CACJ,CAAC,CAAA;AAEF,gDAAyB;AACzB,gDAA2E;AAC3E,mCAA2E;
|
|
1
|
+
{"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../src/helpers/testHelpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oGAAoG;AACpG;;GAEG;AACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;IAC1C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;KACzB,CAAC,EAT6C,CAS7C,CAAC;CACJ,CAAC,CAAA;AAEF,gDAAyB;AACzB,8DAAgC;AAChC,gDAA2E;AAC3E,mCAA2E;AAC3E,+CAI4B;AAC5B,uEAA+E;AAC/E,yDAAkD;AAC3C,IAAM,kBAAkB,GAAG,UAChC,SAAiC,EACjC,KAA0C,EAC1C,KAA0C,EAC1C,OAAwC;IADxC,sBAAA,EAAA,QAAyB,2BAAiB;IAG1C,OAAA,IAAA,cAAS,EAAC,8BAAC,SAAS,eAAM,KAAW,EAAI,wBACpC,OAAO,KACV,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAAO,OAAA,CACzB,8BAAC,uBAAa,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAiB,CACxD;QAF0B,CAE1B,IACD;AALF,CAKE,CAAA;AAXS,QAAA,kBAAkB,sBAW3B;AAEG,IAAM,oBAAoB,GAAG,UAClC,SAAiC,EACjC,WAAwB,EACxB,OAAgC,EAChC,KAA0C,EAC1C,OAAwC;IAExC,IAAM,aAAa,GAAG,IAAA,sBAAK,EAAC,EAAE,EAAE,sBAAO,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAA;IAC9D,OAAO,IAAA,cAAS,EAAC,8BAAC,SAAS,eAAM,KAAW,EAAI,wBAC3C,OAAO,KACV,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAAO,OAAA,CACzB,8BAAC,gCAAsB,IAAC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW;gBACtE,8BAAC,uBAAa,IAAC,KAAK,EAAE,+BAAY,IAAG,QAAQ,CAAiB,CACvC,CAC1B;QAJ0B,CAI1B,IACD,CAAA;AACJ,CAAC,CAAA;AAhBY,QAAA,oBAAoB,wBAgBhC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/standalone-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0-alpha.0",
|
|
4
4
|
"description": "Newskit Render Standalone Components",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"jest-watch-typeahead": "0.6.3",
|
|
56
56
|
"lint-staged": "12.1.7",
|
|
57
57
|
"newskit": "5.4.5",
|
|
58
|
+
"next": "12.1.0",
|
|
58
59
|
"prettier": "2.2.1",
|
|
59
60
|
"react": "17.0.2",
|
|
60
61
|
"react-dom": "17.0.2",
|
|
@@ -82,9 +83,11 @@
|
|
|
82
83
|
"@newskit-render/api": "^0.35.0",
|
|
83
84
|
"@newskit-render/shared-components": "^0.65.0",
|
|
84
85
|
"algoliasearch": "4.13.1",
|
|
86
|
+
"cross-fetch": "3.1.5",
|
|
85
87
|
"graphql": "15.6.0",
|
|
86
88
|
"lodash.assign": "4.2.0",
|
|
87
|
-
"lodash.merge": "4.6.2"
|
|
89
|
+
"lodash.merge": "4.6.2",
|
|
90
|
+
"xss": "1.0.13"
|
|
88
91
|
},
|
|
89
92
|
"resolutions": {
|
|
90
93
|
"@types/react": "^17.0.1",
|