@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.
Files changed (58) hide show
  1. package/dist/bridgeClient.d.ts +10 -0
  2. package/dist/bridgeClient.js +10 -0
  3. package/dist/bridgeClient.js.map +7 -0
  4. package/dist/chunks/chunk-2554RPSS.js +45 -0
  5. package/dist/chunks/chunk-2554RPSS.js.map +7 -0
  6. package/dist/chunks/chunk-2BH4QPV2.js +27 -0
  7. package/dist/chunks/chunk-2BH4QPV2.js.map +7 -0
  8. package/dist/chunks/chunk-3KEEGSMP.js +86 -0
  9. package/dist/chunks/chunk-3KEEGSMP.js.map +7 -0
  10. package/dist/chunks/chunk-5DN7L6LX.js +861 -0
  11. package/dist/chunks/chunk-5DN7L6LX.js.map +7 -0
  12. package/dist/chunks/chunk-DUVULZ6N.js +111 -0
  13. package/dist/chunks/chunk-DUVULZ6N.js.map +7 -0
  14. package/dist/chunks/chunk-GJZ7EZEF.js +25 -0
  15. package/dist/chunks/chunk-GJZ7EZEF.js.map +7 -0
  16. package/dist/chunks/chunk-HFEQWXG6.js +24 -0
  17. package/dist/chunks/chunk-HFEQWXG6.js.map +7 -0
  18. package/dist/chunks/chunk-OFFTL6RC.js +24 -0
  19. package/dist/chunks/chunk-OFFTL6RC.js.map +7 -0
  20. package/dist/chunks/chunk-TSERNR4R.js +15 -0
  21. package/dist/chunks/chunk-TSERNR4R.js.map +7 -0
  22. package/dist/chunks/chunk-ZITPZDI7.js +280 -0
  23. package/dist/chunks/chunk-ZITPZDI7.js.map +7 -0
  24. package/dist/client.d.ts +407 -0
  25. package/dist/client.js +14 -0
  26. package/dist/client.js.map +7 -0
  27. package/dist/companyApiKey.d.ts +9 -0
  28. package/dist/companyApiKey.js +9 -0
  29. package/dist/companyApiKey.js.map +7 -0
  30. package/dist/customerToken.d.ts +18 -0
  31. package/dist/customerToken.js +11 -0
  32. package/dist/customerToken.js.map +7 -0
  33. package/dist/errors.d.ts +41 -0
  34. package/dist/errors.js +9 -0
  35. package/dist/errors.js.map +7 -0
  36. package/dist/index.d.ts +82 -0
  37. package/dist/index.js +166 -0
  38. package/dist/index.js.map +7 -0
  39. package/dist/language.d.ts +27 -0
  40. package/dist/language.js +11 -0
  41. package/dist/language.js.map +7 -0
  42. package/dist/params.d.ts +58 -0
  43. package/dist/params.js +27 -0
  44. package/dist/params.js.map +7 -0
  45. package/dist/requestCache.d.ts +46 -0
  46. package/dist/requestCache.js +9 -0
  47. package/dist/requestCache.js.map +7 -0
  48. package/dist/siteData.d.ts +237 -0
  49. package/dist/siteData.js +132 -0
  50. package/dist/siteData.js.map +7 -0
  51. package/dist/types.d.ts +2123 -0
  52. package/dist/types.js +1 -0
  53. package/dist/types.js.map +7 -0
  54. package/dist/visitorCountry.d.ts +25 -0
  55. package/dist/visitorCountry.js +15 -0
  56. package/dist/visitorCountry.js.map +7 -0
  57. package/package.json +64 -4
  58. package/README.md +0 -3
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@estoreclub/api",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
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
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.