@wix/headless-site 1.0.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.
Files changed (40) hide show
  1. package/README.md +13 -0
  2. package/dist/cjs/external-types.d.js +2 -0
  3. package/dist/cjs/external-types.d.js.map +1 -0
  4. package/dist/cjs/headers/common-config-header.js +37 -0
  5. package/dist/cjs/headers/common-config-header.js.map +1 -0
  6. package/dist/cjs/headers/index.js +22 -0
  7. package/dist/cjs/headers/index.js.map +1 -0
  8. package/dist/cjs/host-module.js +24 -0
  9. package/dist/cjs/host-module.js.map +1 -0
  10. package/dist/cjs/index.js +7 -0
  11. package/dist/cjs/index.js.map +1 -0
  12. package/dist/cjs/test-types.d.js +2 -0
  13. package/dist/cjs/test-types.d.js.map +1 -0
  14. package/dist/cjs/types.js +2 -0
  15. package/dist/cjs/types.js.map +1 -0
  16. package/dist/esm/external-types.d.js +2 -0
  17. package/dist/esm/external-types.d.js.map +1 -0
  18. package/dist/esm/headers/common-config-header.js +33 -0
  19. package/dist/esm/headers/common-config-header.js.map +1 -0
  20. package/dist/esm/headers/index.js +20 -0
  21. package/dist/esm/headers/index.js.map +1 -0
  22. package/dist/esm/host-module.js +19 -0
  23. package/dist/esm/host-module.js.map +1 -0
  24. package/dist/esm/index.js +3 -0
  25. package/dist/esm/index.js.map +1 -0
  26. package/dist/esm/test-types.d.js +2 -0
  27. package/dist/esm/test-types.d.js.map +1 -0
  28. package/dist/esm/types.js +2 -0
  29. package/dist/esm/types.js.map +1 -0
  30. package/dist/types/headers/common-config-header.d.ts +10 -0
  31. package/dist/types/headers/common-config-header.d.ts.map +1 -0
  32. package/dist/types/headers/index.d.ts +5 -0
  33. package/dist/types/headers/index.d.ts.map +1 -0
  34. package/dist/types/host-module.d.ts +6 -0
  35. package/dist/types/host-module.d.ts.map +1 -0
  36. package/dist/types/index.d.ts +4 -0
  37. package/dist/types/index.d.ts.map +1 -0
  38. package/dist/types/types.d.ts +2 -0
  39. package/dist/types/types.d.ts.map +1 -0
  40. package/package.json +82 -0
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @wix/headless-site
2
+ Headless site API.
3
+
4
+ Host usage:
5
+
6
+ ```js
7
+ import { headlessSite } from '@wix/headless-site';
8
+ import { createClient } from '@wix/sdk';
9
+
10
+ const sdkClient = createClient({
11
+ host: headlessSite.host(),
12
+ });
13
+ ```
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/yoshi-flow-library/types" />
2
+ //# sourceMappingURL=external-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/external-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/yoshi-flow-library/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getCommonConfigHeader = void 0;
5
+ /**
6
+ * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/headers/common-config.ts
7
+ */
8
+
9
+ const COMMON_CONFIG_HEADER_NAME = 'commonConfig';
10
+ const IGNORE_KEYS = new Set(['consentPolicy', 'consentPolicyHeader']);
11
+ const MAP_KEYS = new Map([['bsi', 'BSI']]);
12
+ const getCommonConfigValues = () => {
13
+ const {
14
+ commonConfig
15
+ } = globalThis;
16
+ if (!commonConfig) {
17
+ return null;
18
+ }
19
+ const entries = Object.entries(commonConfig).reduce((res, [key, value]) => {
20
+ if (typeof value !== 'undefined' &&
21
+ // This can happen if the value was explicitly set to undefined
22
+ typeof value !== 'function' && !IGNORE_KEYS.has(key)) {
23
+ res.push([MAP_KEYS.get(key) ?? key, value]);
24
+ }
25
+ return res;
26
+ }, []);
27
+ return entries.length > 0 ? Object.fromEntries(entries) : null;
28
+ };
29
+ const getCommonConfigHeader = () => {
30
+ const commonConfigValues = getCommonConfigValues();
31
+ const value = commonConfigValues ? JSON.stringify(commonConfigValues) : '';
32
+ return {
33
+ [COMMON_CONFIG_HEADER_NAME]: encodeURIComponent(value)
34
+ };
35
+ };
36
+ exports.getCommonConfigHeader = getCommonConfigHeader;
37
+ //# sourceMappingURL=common-config-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COMMON_CONFIG_HEADER_NAME","IGNORE_KEYS","Set","MAP_KEYS","Map","getCommonConfigValues","commonConfig","globalThis","entries","Object","reduce","res","key","value","has","push","get","length","fromEntries","getCommonConfigHeader","commonConfigValues","JSON","stringify","encodeURIComponent","exports"],"sources":["../../../src/headers/common-config-header.ts"],"sourcesContent":["/**\n * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/headers/common-config.ts\n */\n\nconst COMMON_CONFIG_HEADER_NAME = 'commonConfig';\nconst IGNORE_KEYS = new Set(['consentPolicy', 'consentPolicyHeader']);\nconst MAP_KEYS = new Map<string, string>([['bsi', 'BSI']]);\n\ndeclare global {\n // eslint-disable-next-line no-var\n var commonConfig: Record<string, any> | undefined;\n}\n\nconst getCommonConfigValues = () => {\n const { commonConfig } = globalThis;\n\n if (!commonConfig) {\n return null;\n }\n\n const entries = Object.entries(commonConfig).reduce<[string, any][]>(\n (res, [key, value]) => {\n if (\n typeof value !== 'undefined' && // This can happen if the value was explicitly set to undefined\n typeof value !== 'function' &&\n !IGNORE_KEYS.has(key)\n ) {\n res.push([MAP_KEYS.get(key) ?? key, value]);\n }\n\n return res;\n },\n [],\n );\n\n return entries.length > 0 ? Object.fromEntries(entries) : null;\n};\n\nexport const getCommonConfigHeader = () => {\n const commonConfigValues = getCommonConfigValues();\n const value = commonConfigValues ? JSON.stringify(commonConfigValues) : '';\n\n return {\n [COMMON_CONFIG_HEADER_NAME]: encodeURIComponent(value),\n };\n};\n"],"mappings":";;;;AAAA;AACA;AACA;;AAEA,MAAMA,yBAAyB,GAAG,cAAc;AAChD,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAC,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;AACrE,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAiB,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAO1D,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EAClC,MAAM;IAAEC;EAAa,CAAC,GAAGC,UAAU;EAEnC,IAAI,CAACD,YAAY,EAAE;IACjB,OAAO,IAAI;EACb;EAEA,MAAME,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACF,YAAY,CAAC,CAACI,MAAM,CACjD,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IACrB,IACE,OAAOA,KAAK,KAAK,WAAW;IAAI;IAChC,OAAOA,KAAK,KAAK,UAAU,IAC3B,CAACZ,WAAW,CAACa,GAAG,CAACF,GAAG,CAAC,EACrB;MACAD,GAAG,CAACI,IAAI,CAAC,CAACZ,QAAQ,CAACa,GAAG,CAACJ,GAAG,CAAC,IAAIA,GAAG,EAAEC,KAAK,CAAC,CAAC;IAC7C;IAEA,OAAOF,GAAG;EACZ,CAAC,EACD,EACF,CAAC;EAED,OAAOH,OAAO,CAACS,MAAM,GAAG,CAAC,GAAGR,MAAM,CAACS,WAAW,CAACV,OAAO,CAAC,GAAG,IAAI;AAChE,CAAC;AAEM,MAAMW,qBAAqB,GAAGA,CAAA,KAAM;EACzC,MAAMC,kBAAkB,GAAGf,qBAAqB,CAAC,CAAC;EAClD,MAAMQ,KAAK,GAAGO,kBAAkB,GAAGC,IAAI,CAACC,SAAS,CAACF,kBAAkB,CAAC,GAAG,EAAE;EAE1E,OAAO;IACL,CAACpB,yBAAyB,GAAGuB,kBAAkB,CAACV,KAAK;EACvD,CAAC;AACH,CAAC;AAACW,OAAA,CAAAL,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getPassThroughHeaders = void 0;
5
+ var _commonConfigHeader = require("./common-config-header");
6
+ /**
7
+ * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/index.ts
8
+ */
9
+
10
+ const getPassThroughHeaders = () => {
11
+ const headers = [(0, _commonConfigHeader.getCommonConfigHeader)()];
12
+ return headers.reduce((res, header) => {
13
+ const entries = Object.entries(header).filter(([_, value]) => !!value);
14
+ res = {
15
+ ...res,
16
+ ...Object.fromEntries(entries)
17
+ };
18
+ return res;
19
+ }, {});
20
+ };
21
+ exports.getPassThroughHeaders = getPassThroughHeaders;
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_commonConfigHeader","require","getPassThroughHeaders","headers","getCommonConfigHeader","reduce","res","header","entries","Object","filter","_","value","fromEntries","exports"],"sources":["../../../src/headers/index.ts"],"sourcesContent":["/**\n * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/index.ts\n */\n\nimport { getCommonConfigHeader } from './common-config-header';\n\nexport const getPassThroughHeaders = () => {\n const headers = [getCommonConfigHeader()];\n\n return headers.reduce((res, header) => {\n const entries = Object.entries(header).filter(([_, value]) => !!value);\n\n res = {\n ...res,\n ...Object.fromEntries(entries),\n };\n\n return res;\n }, {} as Record<string, string>);\n};\n"],"mappings":";;;;AAIA,IAAAA,mBAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACzC,MAAMC,OAAO,GAAG,CAAC,IAAAC,yCAAqB,EAAC,CAAC,CAAC;EAEzC,OAAOD,OAAO,CAACE,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;IACrC,MAAMC,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,MAAM,CAAC,CAACG,MAAM,CAAC,CAAC,CAACC,CAAC,EAAEC,KAAK,CAAC,KAAK,CAAC,CAACA,KAAK,CAAC;IAEtEN,GAAG,GAAG;MACJ,GAAGA,GAAG;MACN,GAAGG,MAAM,CAACI,WAAW,CAACL,OAAO;IAC/B,CAAC;IAED,OAAOF,GAAG;EACZ,CAAC,EAAE,CAAC,CAA2B,CAAC;AAClC,CAAC;AAACQ,OAAA,CAAAZ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.createHostModule = void 0;
5
+ var _headers = require("./headers");
6
+ const createHostModule = () => {
7
+ return {
8
+ __type: 'host',
9
+ create: () => {
10
+ return {};
11
+ },
12
+ host: () => {
13
+ return {
14
+ essentials: {
15
+ get passThroughHeaders() {
16
+ return (0, _headers.getPassThroughHeaders)();
17
+ }
18
+ }
19
+ };
20
+ }
21
+ };
22
+ };
23
+ exports.createHostModule = createHostModule;
24
+ //# sourceMappingURL=host-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_headers","require","createHostModule","__type","create","host","essentials","passThroughHeaders","getPassThroughHeaders","exports"],"sources":["../../src/host-module.ts"],"sourcesContent":["import type { HostModule, Host } from '@wix/sdk-types';\nimport type { SDK } from './types';\nimport { getPassThroughHeaders } from './headers';\n\nexport const createHostModule = (): HostModule<SDK, Host> & {\n host: () => Host;\n} => {\n return {\n __type: 'host',\n create: () => {\n return {};\n },\n host: () => {\n return {\n essentials: {\n get passThroughHeaders() {\n return getPassThroughHeaders();\n },\n },\n };\n },\n };\n};\n"],"mappings":";;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEO,MAAMC,gBAAgB,GAAGA,CAAA,KAE3B;EACH,OAAO;IACLC,MAAM,EAAE,MAAM;IACdC,MAAM,EAAEA,CAAA,KAAM;MACZ,OAAO,CAAC,CAAC;IACX,CAAC;IACDC,IAAI,EAAEA,CAAA,KAAM;MACV,OAAO;QACLC,UAAU,EAAE;UACV,IAAIC,kBAAkBA,CAAA,EAAG;YACvB,OAAO,IAAAC,8BAAqB,EAAC,CAAC;UAChC;QACF;MACF,CAAC;IACH;EACF,CAAC;AACH,CAAC;AAACC,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.headlessSite = void 0;
5
+ var _hostModule = require("./host-module");
6
+ const headlessSite = exports.headlessSite = (0, _hostModule.createHostModule)();
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hostModule","require","headlessSite","exports","createHostModule"],"sources":["../../src/index.ts"],"sourcesContent":["import { createHostModule } from './host-module';\n\nexport const headlessSite = createHostModule();\n"],"mappings":";;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,4BAAgB,EAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/jest-yoshi-preset/types" />
2
+ //# sourceMappingURL=test-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/test-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/jest-yoshi-preset/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/types.ts"],"sourcesContent":["export type SDK = {};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/yoshi-flow-library/types" />
2
+ //# sourceMappingURL=external-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/external-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/yoshi-flow-library/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/headers/common-config.ts
3
+ */
4
+
5
+ const COMMON_CONFIG_HEADER_NAME = 'commonConfig';
6
+ const IGNORE_KEYS = new Set(['consentPolicy', 'consentPolicyHeader']);
7
+ const MAP_KEYS = new Map([['bsi', 'BSI']]);
8
+ const getCommonConfigValues = () => {
9
+ const {
10
+ commonConfig
11
+ } = globalThis;
12
+ if (!commonConfig) {
13
+ return null;
14
+ }
15
+ const entries = Object.entries(commonConfig).reduce((res, _ref) => {
16
+ let [key, value] = _ref;
17
+ if (typeof value !== 'undefined' &&
18
+ // This can happen if the value was explicitly set to undefined
19
+ typeof value !== 'function' && !IGNORE_KEYS.has(key)) {
20
+ res.push([MAP_KEYS.get(key) ?? key, value]);
21
+ }
22
+ return res;
23
+ }, []);
24
+ return entries.length > 0 ? Object.fromEntries(entries) : null;
25
+ };
26
+ export const getCommonConfigHeader = () => {
27
+ const commonConfigValues = getCommonConfigValues();
28
+ const value = commonConfigValues ? JSON.stringify(commonConfigValues) : '';
29
+ return {
30
+ [COMMON_CONFIG_HEADER_NAME]: encodeURIComponent(value)
31
+ };
32
+ };
33
+ //# sourceMappingURL=common-config-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COMMON_CONFIG_HEADER_NAME","IGNORE_KEYS","Set","MAP_KEYS","Map","getCommonConfigValues","commonConfig","globalThis","entries","Object","reduce","res","_ref","key","value","has","push","get","length","fromEntries","getCommonConfigHeader","commonConfigValues","JSON","stringify","encodeURIComponent"],"sources":["../../../src/headers/common-config-header.ts"],"sourcesContent":["/**\n * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/headers/common-config.ts\n */\n\nconst COMMON_CONFIG_HEADER_NAME = 'commonConfig';\nconst IGNORE_KEYS = new Set(['consentPolicy', 'consentPolicyHeader']);\nconst MAP_KEYS = new Map<string, string>([['bsi', 'BSI']]);\n\ndeclare global {\n // eslint-disable-next-line no-var\n var commonConfig: Record<string, any> | undefined;\n}\n\nconst getCommonConfigValues = () => {\n const { commonConfig } = globalThis;\n\n if (!commonConfig) {\n return null;\n }\n\n const entries = Object.entries(commonConfig).reduce<[string, any][]>(\n (res, [key, value]) => {\n if (\n typeof value !== 'undefined' && // This can happen if the value was explicitly set to undefined\n typeof value !== 'function' &&\n !IGNORE_KEYS.has(key)\n ) {\n res.push([MAP_KEYS.get(key) ?? key, value]);\n }\n\n return res;\n },\n [],\n );\n\n return entries.length > 0 ? Object.fromEntries(entries) : null;\n};\n\nexport const getCommonConfigHeader = () => {\n const commonConfigValues = getCommonConfigValues();\n const value = commonConfigValues ? JSON.stringify(commonConfigValues) : '';\n\n return {\n [COMMON_CONFIG_HEADER_NAME]: encodeURIComponent(value),\n };\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA,MAAMA,yBAAyB,GAAG,cAAc;AAChD,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAC,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;AACrE,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAiB,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAO1D,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EAClC,MAAM;IAAEC;EAAa,CAAC,GAAGC,UAAU;EAEnC,IAAI,CAACD,YAAY,EAAE;IACjB,OAAO,IAAI;EACb;EAEA,MAAME,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACF,YAAY,CAAC,CAACI,MAAM,CACjD,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IAChB,IACE,OAAOE,KAAK,KAAK,WAAW;IAAI;IAChC,OAAOA,KAAK,KAAK,UAAU,IAC3B,CAACb,WAAW,CAACc,GAAG,CAACF,GAAG,CAAC,EACrB;MACAF,GAAG,CAACK,IAAI,CAAC,CAACb,QAAQ,CAACc,GAAG,CAACJ,GAAG,CAAC,IAAIA,GAAG,EAAEC,KAAK,CAAC,CAAC;IAC7C;IAEA,OAAOH,GAAG;EACZ,CAAC,EACD,EACF,CAAC;EAED,OAAOH,OAAO,CAACU,MAAM,GAAG,CAAC,GAAGT,MAAM,CAACU,WAAW,CAACX,OAAO,CAAC,GAAG,IAAI;AAChE,CAAC;AAED,OAAO,MAAMY,qBAAqB,GAAGA,CAAA,KAAM;EACzC,MAAMC,kBAAkB,GAAGhB,qBAAqB,CAAC,CAAC;EAClD,MAAMS,KAAK,GAAGO,kBAAkB,GAAGC,IAAI,CAACC,SAAS,CAACF,kBAAkB,CAAC,GAAG,EAAE;EAE1E,OAAO;IACL,CAACrB,yBAAyB,GAAGwB,kBAAkB,CAACV,KAAK;EACvD,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/index.ts
3
+ */
4
+
5
+ import { getCommonConfigHeader } from './common-config-header';
6
+ export const getPassThroughHeaders = () => {
7
+ const headers = [getCommonConfigHeader()];
8
+ return headers.reduce((res, header) => {
9
+ const entries = Object.entries(header).filter(_ref => {
10
+ let [_, value] = _ref;
11
+ return !!value;
12
+ });
13
+ res = {
14
+ ...res,
15
+ ...Object.fromEntries(entries)
16
+ };
17
+ return res;
18
+ }, {});
19
+ };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getCommonConfigHeader","getPassThroughHeaders","headers","reduce","res","header","entries","Object","filter","_ref","_","value","fromEntries"],"sources":["../../../src/headers/index.ts"],"sourcesContent":["/**\n * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/index.ts\n */\n\nimport { getCommonConfigHeader } from './common-config-header';\n\nexport const getPassThroughHeaders = () => {\n const headers = [getCommonConfigHeader()];\n\n return headers.reduce((res, header) => {\n const entries = Object.entries(header).filter(([_, value]) => !!value);\n\n res = {\n ...res,\n ...Object.fromEntries(entries),\n };\n\n return res;\n }, {} as Record<string, string>);\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,qBAAqB,QAAQ,wBAAwB;AAE9D,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACzC,MAAMC,OAAO,GAAG,CAACF,qBAAqB,CAAC,CAAC,CAAC;EAEzC,OAAOE,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;IACrC,MAAMC,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,MAAM,CAAC,CAACG,MAAM,CAACC,IAAA;MAAA,IAAC,CAACC,CAAC,EAAEC,KAAK,CAAC,GAAAF,IAAA;MAAA,OAAK,CAAC,CAACE,KAAK;IAAA,EAAC;IAEtEP,GAAG,GAAG;MACJ,GAAGA,GAAG;MACN,GAAGG,MAAM,CAACK,WAAW,CAACN,OAAO;IAC/B,CAAC;IAED,OAAOF,GAAG;EACZ,CAAC,EAAE,CAAC,CAA2B,CAAC;AAClC,CAAC","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import { getPassThroughHeaders } from './headers';
2
+ export const createHostModule = () => {
3
+ return {
4
+ __type: 'host',
5
+ create: () => {
6
+ return {};
7
+ },
8
+ host: () => {
9
+ return {
10
+ essentials: {
11
+ get passThroughHeaders() {
12
+ return getPassThroughHeaders();
13
+ }
14
+ }
15
+ };
16
+ }
17
+ };
18
+ };
19
+ //# sourceMappingURL=host-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getPassThroughHeaders","createHostModule","__type","create","host","essentials","passThroughHeaders"],"sources":["../../src/host-module.ts"],"sourcesContent":["import type { HostModule, Host } from '@wix/sdk-types';\nimport type { SDK } from './types';\nimport { getPassThroughHeaders } from './headers';\n\nexport const createHostModule = (): HostModule<SDK, Host> & {\n host: () => Host;\n} => {\n return {\n __type: 'host',\n create: () => {\n return {};\n },\n host: () => {\n return {\n essentials: {\n get passThroughHeaders() {\n return getPassThroughHeaders();\n },\n },\n };\n },\n };\n};\n"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,WAAW;AAEjD,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAE3B;EACH,OAAO;IACLC,MAAM,EAAE,MAAM;IACdC,MAAM,EAAEA,CAAA,KAAM;MACZ,OAAO,CAAC,CAAC;IACX,CAAC;IACDC,IAAI,EAAEA,CAAA,KAAM;MACV,OAAO;QACLC,UAAU,EAAE;UACV,IAAIC,kBAAkBA,CAAA,EAAG;YACvB,OAAON,qBAAqB,CAAC,CAAC;UAChC;QACF;MACF,CAAC;IACH;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { createHostModule } from './host-module';
2
+ export const headlessSite = createHostModule();
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createHostModule","headlessSite"],"sources":["../../src/index.ts"],"sourcesContent":["import { createHostModule } from './host-module';\n\nexport const headlessSite = createHostModule();\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,eAAe;AAEhD,OAAO,MAAMC,YAAY,GAAGD,gBAAgB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ /// <reference types="@wix/jest-yoshi-preset/types" />
2
+ //# sourceMappingURL=test-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/test-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/jest-yoshi-preset/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/types.ts"],"sourcesContent":["export type SDK = {};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/headers/common-config.ts
3
+ */
4
+ declare global {
5
+ var commonConfig: Record<string, any> | undefined;
6
+ }
7
+ export declare const getCommonConfigHeader: () => {
8
+ commonConfig: string;
9
+ };
10
+ //# sourceMappingURL=common-config-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-config-header.d.ts","sourceRoot":"","sources":["../../../src/headers/common-config-header.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CACnD;AA2BD,eAAO,MAAM,qBAAqB;;CAOjC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Based on https://github.com/wix-private/metro/blob/master/packages/wix-headers/src/index.ts
3
+ */
4
+ export declare const getPassThroughHeaders: () => Record<string, string>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/headers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAO,MAAM,qBAAqB,8BAajC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { HostModule, Host } from '@wix/sdk-types';
2
+ import type { SDK } from './types';
3
+ export declare const createHostModule: () => HostModule<SDK, Host> & {
4
+ host: () => Host;
5
+ };
6
+ //# sourceMappingURL=host-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-module.d.ts","sourceRoot":"","sources":["../../src/host-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAGnC,eAAO,MAAM,gBAAgB,QAAO,WAAW,GAAG,EAAE,IAAI,CAAC,GAAG;IAC1D,IAAI,EAAE,MAAM,IAAI,CAAC;CAiBlB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const headlessSite: import("@wix/sdk-types").HostModule<import("./types").SDK, import("@wix/sdk-types").Host<unknown>> & {
2
+ host: () => import("@wix/sdk-types").Host<unknown>;
3
+ };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;CAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare type SDK = {};
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,GAAG,GAAG,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@wix/headless-site",
3
+ "version": "1.0.0",
4
+ "unpkg": true,
5
+ "license": "UNLICENSED",
6
+ "author": {
7
+ "name": "Anton Podolsky",
8
+ "email": "antonp@wix.com"
9
+ },
10
+ "main": "dist/cjs/index.js",
11
+ "module": "dist/esm/index.js",
12
+ "sideEffects": false,
13
+ "types": "dist/types/index.d.ts",
14
+ "files": [
15
+ "dist/cjs",
16
+ "dist/esm",
17
+ "dist/types"
18
+ ],
19
+ "publishConfig": {
20
+ "registry": "https://registry.npmjs.org/",
21
+ "access": "public"
22
+ },
23
+ "publishScoped": true,
24
+ "scripts": {
25
+ "build": "yoshi-library build",
26
+ "start": "yoshi-library start",
27
+ "test": "yoshi-library test",
28
+ "lint": "yoshi-library lint"
29
+ },
30
+ "husky": {
31
+ "hooks": {
32
+ "pre-commit": "lint-staged"
33
+ }
34
+ },
35
+ "lint-staged": {
36
+ "*.{js,ts}": "yarn lint"
37
+ },
38
+ "dependencies": {
39
+ "@babel/runtime": "^7.0.0",
40
+ "@wix/sdk-types": "^1.13.31"
41
+ },
42
+ "devDependencies": {
43
+ "@types/jest": "^27.4.0",
44
+ "@types/node": "^16.0.0",
45
+ "@wix/eslint-config-yoshi": "^6.131.0",
46
+ "@wix/jest-yoshi-preset": "^6.131.0",
47
+ "@wix/yoshi-flow-library": "^6.141.0",
48
+ "chance": "^1.1.13",
49
+ "husky": "^4.2.1",
50
+ "lint-staged": "^10.5.4",
51
+ "prettier": "^2.0.5",
52
+ "ts-jest": "^27.1.2",
53
+ "typescript": "~4.9.0"
54
+ },
55
+ "jest": {
56
+ "preset": "@wix/jest-yoshi-preset"
57
+ },
58
+ "yoshiFlowLibrary": {
59
+ "buildEsmWithBabel": true
60
+ },
61
+ "eslintConfig": {
62
+ "extends": "@wix/eslint-config-yoshi"
63
+ },
64
+ "wix": {
65
+ "artifact": {
66
+ "groupId": "com.wixpress",
67
+ "artifactId": "headless-site-sdk"
68
+ },
69
+ "validations": {
70
+ "postDependenciesBuild": [
71
+ "lint"
72
+ ]
73
+ },
74
+ "framework": {
75
+ "type": "yoshi-flow-library"
76
+ }
77
+ },
78
+ "wallaby": {
79
+ "autoDetect": true
80
+ },
81
+ "falconPackageHash": "bc26a56f7d240dd1737a70bc42cad1ba7141316b918302ecd556700e"
82
+ }