@estoreclub/api 0.0.0-stage → 0.1.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/bridgeClient.d.ts +10 -0
- package/dist/bridgeClient.js +10 -0
- package/dist/bridgeClient.js.map +7 -0
- package/dist/chunks/chunk-2554RPSS.js +45 -0
- package/dist/chunks/chunk-2554RPSS.js.map +7 -0
- package/dist/chunks/chunk-2BH4QPV2.js +27 -0
- package/dist/chunks/chunk-2BH4QPV2.js.map +7 -0
- package/dist/chunks/chunk-3KEEGSMP.js +86 -0
- package/dist/chunks/chunk-3KEEGSMP.js.map +7 -0
- package/dist/chunks/chunk-5DN7L6LX.js +861 -0
- package/dist/chunks/chunk-5DN7L6LX.js.map +7 -0
- package/dist/chunks/chunk-DUVULZ6N.js +111 -0
- package/dist/chunks/chunk-DUVULZ6N.js.map +7 -0
- package/dist/chunks/chunk-GJZ7EZEF.js +25 -0
- package/dist/chunks/chunk-GJZ7EZEF.js.map +7 -0
- package/dist/chunks/chunk-HFEQWXG6.js +24 -0
- package/dist/chunks/chunk-HFEQWXG6.js.map +7 -0
- package/dist/chunks/chunk-OFFTL6RC.js +24 -0
- package/dist/chunks/chunk-OFFTL6RC.js.map +7 -0
- package/dist/chunks/chunk-TSERNR4R.js +15 -0
- package/dist/chunks/chunk-TSERNR4R.js.map +7 -0
- package/dist/chunks/chunk-ZITPZDI7.js +280 -0
- package/dist/chunks/chunk-ZITPZDI7.js.map +7 -0
- package/dist/client.d.ts +407 -0
- package/dist/client.js +14 -0
- package/dist/client.js.map +7 -0
- package/dist/companyApiKey.d.ts +9 -0
- package/dist/companyApiKey.js +9 -0
- package/dist/companyApiKey.js.map +7 -0
- package/dist/customerToken.d.ts +18 -0
- package/dist/customerToken.js +11 -0
- package/dist/customerToken.js.map +7 -0
- package/dist/errors.d.ts +41 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +7 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +7 -0
- package/dist/language.d.ts +27 -0
- package/dist/language.js +11 -0
- package/dist/language.js.map +7 -0
- package/dist/params.d.ts +58 -0
- package/dist/params.js +27 -0
- package/dist/params.js.map +7 -0
- package/dist/requestCache.d.ts +46 -0
- package/dist/requestCache.js +9 -0
- package/dist/requestCache.js.map +7 -0
- package/dist/siteData.d.ts +237 -0
- package/dist/siteData.js +132 -0
- package/dist/siteData.js.map +7 -0
- package/dist/types.d.ts +2123 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +7 -0
- package/dist/visitorCountry.d.ts +25 -0
- package/dist/visitorCountry.js +15 -0
- package/dist/visitorCountry.js.map +7 -0
- package/package.json +64 -4
- package/README.md +0 -3
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The country the visitor a render is made for is in, for `getSiteInfo().visitorCountry`.
|
|
3
|
+
*
|
|
4
|
+
* Only the request knows it - the CDN's country header, else the region of the language the
|
|
5
|
+
* browser asks for - and a page's reads are made on the server, per request. So the render tier
|
|
6
|
+
* reads it from the request and sets a resolver here for the length of one render, the same way
|
|
7
|
+
* it sets the language (`language.ts`) and the customer (`customerToken.ts`). A site then writes
|
|
8
|
+
* its own dollar as a bare "$" for a visitor at home, and says whose it is to anyone else.
|
|
9
|
+
*
|
|
10
|
+
* Nothing set - a static build, no request - means unknown: null.
|
|
11
|
+
*/
|
|
12
|
+
export type VisitorCountryResolver = () => string | null | undefined;
|
|
13
|
+
export declare function setVisitorCountryResolver(next: VisitorCountryResolver | null): void;
|
|
14
|
+
/** The resolver in force, so the render tier can put back exactly what was there. */
|
|
15
|
+
export declare function getVisitorCountryResolver(): VisitorCountryResolver | null;
|
|
16
|
+
/** "NZ", or null when nobody said. Never throws. */
|
|
17
|
+
export declare function resolveVisitorCountry(): string | null;
|
|
18
|
+
/** Two letters, upper case - or null for anything else ("XX", "T1" and the like included). */
|
|
19
|
+
export declare function normalCountry(value: unknown): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* The visitor's country from a request's headers: the CDN's own (`cloudfront-viewer-country`,
|
|
22
|
+
* `cf-ipcountry`, `x-vercel-ip-country`), else the region of the first language the browser asks
|
|
23
|
+
* for ("en-NZ" → "NZ"). For the render tiers, which hold the request.
|
|
24
|
+
*/
|
|
25
|
+
export declare function countryFromHeaders(header: (name: string) => string | null | undefined): string | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
countryFromHeaders,
|
|
3
|
+
getVisitorCountryResolver,
|
|
4
|
+
normalCountry,
|
|
5
|
+
resolveVisitorCountry,
|
|
6
|
+
setVisitorCountryResolver
|
|
7
|
+
} from "./chunks/chunk-2554RPSS.js";
|
|
8
|
+
export {
|
|
9
|
+
countryFromHeaders,
|
|
10
|
+
getVisitorCountryResolver,
|
|
11
|
+
normalCountry,
|
|
12
|
+
resolveVisitorCountry,
|
|
13
|
+
setVisitorCountryResolver
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=visitorCountry.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estoreclub/api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed client for the server's PUBLIC company API — the site, its categories and its products, read by domain. One `fetch`, no framework, no React, no node builtins: the same client serves the page runtime's broker, a standalone Next app and a test.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./bridgeClient": {
|
|
10
|
+
"types": "./dist/bridgeClient.d.ts",
|
|
11
|
+
"default": "./dist/bridgeClient.js"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"types": "./dist/client.d.ts",
|
|
15
|
+
"default": "./dist/client.js"
|
|
16
|
+
},
|
|
17
|
+
"./companyApiKey": {
|
|
18
|
+
"types": "./dist/companyApiKey.d.ts",
|
|
19
|
+
"default": "./dist/companyApiKey.js"
|
|
20
|
+
},
|
|
21
|
+
"./customerToken": {
|
|
22
|
+
"types": "./dist/customerToken.d.ts",
|
|
23
|
+
"default": "./dist/customerToken.js"
|
|
24
|
+
},
|
|
25
|
+
"./errors": {
|
|
26
|
+
"types": "./dist/errors.d.ts",
|
|
27
|
+
"default": "./dist/errors.js"
|
|
28
|
+
},
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./language": {
|
|
34
|
+
"types": "./dist/language.d.ts",
|
|
35
|
+
"default": "./dist/language.js"
|
|
36
|
+
},
|
|
37
|
+
"./params": {
|
|
38
|
+
"types": "./dist/params.d.ts",
|
|
39
|
+
"default": "./dist/params.js"
|
|
40
|
+
},
|
|
41
|
+
"./requestCache": {
|
|
42
|
+
"types": "./dist/requestCache.d.ts",
|
|
43
|
+
"default": "./dist/requestCache.js"
|
|
44
|
+
},
|
|
45
|
+
"./siteData": {
|
|
46
|
+
"types": "./dist/siteData.d.ts",
|
|
47
|
+
"default": "./dist/siteData.js"
|
|
48
|
+
},
|
|
49
|
+
"./types": {
|
|
50
|
+
"types": "./dist/types.d.ts",
|
|
51
|
+
"default": "./dist/types.js"
|
|
52
|
+
},
|
|
53
|
+
"./visitorCountry": {
|
|
54
|
+
"types": "./dist/visitorCountry.d.ts",
|
|
55
|
+
"default": "./dist/visitorCountry.js"
|
|
56
|
+
},
|
|
57
|
+
"./package.json": "./package.json"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist"
|
|
61
|
+
],
|
|
62
|
+
"sideEffects": false,
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
}
|
|
66
|
+
}
|
package/README.md
DELETED