@zappie/sdk 0.0.0-stage → 0.1.1

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 (75) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +79 -2
  4. package/dist/cart/item.d.ts +10 -0
  5. package/dist/cart/item.js +1 -0
  6. package/dist/cart/item.js.map +1 -0
  7. package/dist/cart/quote.d.ts +15 -0
  8. package/dist/cart/quote.js +1 -0
  9. package/dist/cart/quote.js.map +1 -0
  10. package/dist/checkout/index.d.ts +141 -0
  11. package/dist/checkout/index.js +1 -0
  12. package/dist/checkout/index.js.map +1 -0
  13. package/dist/chunk-I55A5QXJ.js +2 -0
  14. package/dist/chunk-I55A5QXJ.js.map +1 -0
  15. package/dist/chunk-LFBQICYU.js +2 -0
  16. package/dist/chunk-LFBQICYU.js.map +1 -0
  17. package/dist/client-BctSrEhO.d.ts +725 -0
  18. package/dist/config/index.d.ts +83 -0
  19. package/dist/config/index.js +1 -0
  20. package/dist/customer/index.d.ts +175 -0
  21. package/dist/customer/index.js +3 -0
  22. package/dist/customer/index.js.map +1 -0
  23. package/dist/customer/react.d.ts +31 -0
  24. package/dist/customer/react.js +3 -0
  25. package/dist/customer/react.js.map +1 -0
  26. package/dist/debug.d.ts +45 -0
  27. package/dist/debug.js +1 -0
  28. package/dist/debug.js.map +1 -0
  29. package/dist/index.d.ts +84 -0
  30. package/dist/index.js +1 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/internal.d.ts +14 -0
  33. package/dist/internal.js +1 -0
  34. package/dist/internal.js.map +1 -0
  35. package/dist/models-Dj-VkdU1.d.ts +230 -0
  36. package/dist/persist/catalogue.d.ts +2 -0
  37. package/dist/persist/catalogue.js +2 -0
  38. package/dist/persist/catalogue.js.map +1 -0
  39. package/dist/places/index.d.ts +121 -0
  40. package/dist/places/index.js +1 -0
  41. package/dist/places/index.js.map +1 -0
  42. package/dist/react/index.d.ts +79 -0
  43. package/dist/react/index.js +2 -0
  44. package/dist/react/index.js.map +1 -0
  45. package/dist/server/index.d.ts +235 -0
  46. package/dist/server/index.js +2 -0
  47. package/dist/server/index.js.map +1 -0
  48. package/dist/template/index.d.ts +16 -0
  49. package/dist/template/index.js +3 -0
  50. package/dist/template/index.js.map +1 -0
  51. package/dist/template/react.d.ts +13 -0
  52. package/dist/template/react.js +3 -0
  53. package/dist/template/react.js.map +1 -0
  54. package/dist/testing/index.d.ts +64 -0
  55. package/dist/testing/index.js +2 -0
  56. package/dist/testing/index.js.map +1 -0
  57. package/dist/transport/category-page.d.ts +17 -0
  58. package/dist/transport/category-page.js +2 -0
  59. package/dist/transport/category-page.js.map +1 -0
  60. package/dist/transport/search.d.ts +7 -0
  61. package/dist/transport/search.js +2 -0
  62. package/dist/transport/search.js.map +1 -0
  63. package/dist/transport/selected-menu.d.ts +2 -0
  64. package/dist/transport/selected-menu.js +2 -0
  65. package/dist/transport/selected-menu.js.map +1 -0
  66. package/dist/transport/store.d.ts +10 -0
  67. package/dist/transport/store.js +2 -0
  68. package/dist/transport/store.js.map +1 -0
  69. package/dist/url/index.d.ts +157 -0
  70. package/dist/url/index.js +2 -0
  71. package/dist/url/index.js.map +1 -0
  72. package/dist/visits/index.d.ts +89 -0
  73. package/dist/visits/index.js +1 -0
  74. package/dist/visits/index.js.map +1 -0
  75. package/package.json +105 -3
@@ -0,0 +1,89 @@
1
+ /**
2
+ * The string storage interface used to retain visit attribution and reached steps.
3
+ */
4
+ type VisitStorage = {
5
+ getItem(key: string): string | null;
6
+ setItem(key: string, value: string): void;
7
+ };
8
+ /**
9
+ * A page-view payload with attribution and flags for a new visit and a newly reached page kind.
10
+ */
11
+ type PageView = {
12
+ path: string;
13
+ title: string;
14
+ source: string;
15
+ campaign: string;
16
+ new: boolean;
17
+ step: boolean;
18
+ };
19
+ /**
20
+ * Supported visit events: adding an item or viewing the bag.
21
+ */
22
+ type VisitEventName = "add" | "bag";
23
+ /**
24
+ * A visit event with its path, attribution and whether this event is a new step.
25
+ */
26
+ type VisitEvent = {
27
+ event: VisitEventName;
28
+ path: string;
29
+ source: string;
30
+ campaign: string;
31
+ step: boolean;
32
+ };
33
+ /**
34
+ * Page location, title, referrer and store name plus the storage used to track the visit.
35
+ */
36
+ type PageViewInput = {
37
+ path: string;
38
+ search: string;
39
+ title: string;
40
+ referrer: string;
41
+ storeName: string;
42
+ storage: VisitStorage;
43
+ };
44
+ /**
45
+ * Build a page-view payload and save visit attribution and reached steps in your storage.
46
+ * On the first page, utm_source takes precedence over the referrer and utm_campaign supplies the campaign.
47
+ *
48
+ * @returns The payload with the store name removed from its title and visit/step flags. Does not send a request.
49
+ */
50
+ declare function pageView(input: PageViewInput): PageView;
51
+ /**
52
+ * Build a visit-event payload and record whether this event has already occurred in storage.
53
+ * Uses stored attribution or empty strings. Does not send a request.
54
+ */
55
+ declare function visitEvent(event: VisitEventName, path: string, storage: VisitStorage): VisitEvent;
56
+ /**
57
+ * Read the saved visit source and campaign from your storage, defaulting each to an empty string.
58
+ */
59
+ declare function visitSource(storage: VisitStorage): {
60
+ source: string;
61
+ campaign: string;
62
+ };
63
+
64
+ /**
65
+ * Page-view details with an optional enabled flag. Browser session storage is supplied automatically.
66
+ */
67
+ type CountPageInput = Omit<PageViewInput, "storage"> & {
68
+ enabled?: boolean;
69
+ };
70
+ /**
71
+ * Record a page view in session storage and send it to /_zappie/view when sendBeacon is available.
72
+ * Passing enabled: false disables this call and subsequent event counting until an enabled page is counted.
73
+ */
74
+ declare function countPage(input: CountPageInput): void;
75
+ /**
76
+ * Send an add or bag event for the current path after countPage has enabled counting.
77
+ * Does nothing without a browser window or sendBeacon support.
78
+ */
79
+ declare function countEvent(event: VisitEventName): void;
80
+ /**
81
+ * Read visit attribution from browser session storage.
82
+ * Returns empty source and campaign strings on the server or when no visit is stored.
83
+ */
84
+ declare function currentSource(): {
85
+ source: string;
86
+ campaign: string;
87
+ };
88
+
89
+ export { type CountPageInput, type PageView, type PageViewInput, type VisitEvent, type VisitEventName, type VisitStorage, countEvent, countPage, currentSource, pageView, visitEvent, visitSource };
@@ -0,0 +1 @@
1
+ var V="zappie_visit";function a(t){try{let e=t.getItem(V);return e?JSON.parse(e):null}catch{return null}}function v(t,e){try{t.setItem(V,JSON.stringify(e));}catch{}}function I(t){return t==="/"?"menu":t.startsWith("/item/")?"item":t==="/cart"?"bag":t==="/checkout"?"checkout":t.startsWith("/checkout/")?"payment":t.startsWith("/orders")?"order":"page"}function d(t,e,n){let i=e.steps??[];return i.includes(n)?false:(e.steps=[...i,n],v(t,e),true)}function E(t,e,n){let i=t.split(/\s+[·|–-]\s+/).filter(s=>s.trim()&&s.trim()!==e).join(" \xB7 ").trim();return i||(n==="/"?"Home":"")}function u(t){let{path:e,search:n,title:i,referrer:s,storeName:S,storage:o}=t,m=a(o),r=m;if(!r){let l=new URLSearchParams(n);r={source:l.get("utm_source")||s,campaign:l.get("utm_campaign")||""},v(o,r);}return {path:e,title:E(i,S,e),source:r.source,campaign:r.campaign,new:m===null,step:d(o,r,I(e))}}function g(t,e,n){let i=a(n)??{source:"",campaign:""};return {event:t,path:e,source:i.source,campaign:i.campaign,step:d(n,i,t)}}function c(t){let e=a(t);return {source:e?.source??"",campaign:e?.campaign??""}}var p=false,h={getItem:()=>null,setItem:()=>{}};function f(){try{return window.sessionStorage}catch{return h}}function y(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}function w(t){navigator.sendBeacon("/_zappie/view",JSON.stringify(t));}function P(t){if(p=false,t.enabled===false)return;let{enabled:e,...n}=t,i=u({...n,storage:f()});p=true,y()&&w(i);}function N(t){!p||typeof window>"u"||!y()||w(g(t,window.location.pathname,f()));}function k(){return typeof window>"u"?{source:"",campaign:""}:c(f())}export{N as countEvent,P as countPage,k as currentSource,u as pageView,g as visitEvent,c as visitSource};//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/visits/page-views.ts","../../src/visits/index.ts"],"names":["VISIT_KEY","stored","storage","raw","save","visit","kindOf","path","reached","kind","steps","titleOf","title","storeName","own","part","pageView","input","search","referrer","known","query","visitEvent","event","visitSource","counting","emptyStorage","session","canSend","send","body","countPage","_enabled","page","view","countEvent","currentSource"],"mappings":"AAAA,IAAMA,CAAAA,CAAY,eAoDlB,SAASC,CAAAA,CAAOC,EAAqC,CACnD,GAAI,CACF,IAAMC,CAAAA,CAAMD,CAAAA,CAAQ,QAAQF,CAAS,CAAA,CACrC,OAAIG,CAAAA,CACK,IAAA,CAAK,MAAMA,CAAG,CAAA,CAEhB,IACT,CAAA,KAAQ,CACN,OAAO,IACT,CACF,CAEA,SAASC,CAAAA,CAAKF,CAAAA,CAAuBG,EAAoB,CACvD,GAAI,CACFH,CAAAA,CAAQ,OAAA,CAAQF,CAAAA,CAAW,KAAK,SAAA,CAAUK,CAAK,CAAC,EAClD,CAAA,KAAQ,CAER,CACF,CAEA,SAASC,CAAAA,CAAOC,CAAAA,CAAsB,CACpC,OAAIA,CAAAA,GAAS,GAAA,CACJ,OAELA,CAAAA,CAAK,UAAA,CAAW,QAAQ,CAAA,CACnB,MAAA,CAELA,CAAAA,GAAS,OAAA,CACJ,KAAA,CAELA,CAAAA,GAAS,YACJ,UAAA,CAELA,CAAAA,CAAK,WAAW,YAAY,CAAA,CACvB,UAELA,CAAAA,CAAK,UAAA,CAAW,SAAS,CAAA,CACpB,OAAA,CAEF,MACT,CAEA,SAASC,CAAAA,CAAQN,EAAuBG,CAAAA,CAAcI,CAAAA,CAAuB,CAC3E,IAAMC,CAAAA,CAAQL,CAAAA,CAAM,KAAA,EAAS,EAAC,CAC9B,OAAIK,CAAAA,CAAM,QAAA,CAASD,CAAI,CAAA,CACd,KAAA,EAETJ,EAAM,KAAA,CAAQ,CAAC,GAAGK,CAAAA,CAAOD,CAAI,CAAA,CAC7BL,EAAKF,CAAAA,CAASG,CAAK,EACZ,IAAA,CACT,CAEA,SAASM,CAAAA,CAAQC,CAAAA,CAAeC,CAAAA,CAAm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,CAAAA,IACFC,CAAAA,CAAKK,CAAI,EAEb,CAMO,SAASC,CAAAA,CAAWZ,EAA6B,CAClD,CAACE,GAAY,OAAO,MAAA,CAAW,KAAe,CAACG,CAAAA,EAAQ,EAG3DC,CAAAA,CAAKP,CAAAA,CAAWC,CAAAA,CAAO,OAAO,QAAA,CAAS,QAAA,CAAUI,GAAS,CAAC,EAC7D,CAMO,SAASS,CAAAA,EAAsD,CACpE,OAAI,OAAO,OAAW,GAAA,CACb,CAAE,OAAQ,EAAA,CAAI,QAAA,CAAU,EAAG,CAAA,CAE7BZ,CAAAA,CAAYG,CAAAA,EAAS,CAC9B","file":"index.js","sourcesContent":["const VISIT_KEY = \"zappie_visit\";\n\n/**\n * The string storage interface used to retain visit attribution and reached steps.\n */\nexport type VisitStorage = {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n};\n\ntype Visit = { source: string; campaign: string; steps?: string[] };\n\n/**\n * A page-view payload with attribution and flags for a new visit and a newly reached page kind.\n */\nexport type PageView = {\n path: string;\n title: string;\n source: string;\n campaign: string;\n new: boolean;\n step: boolean;\n};\n\n/**\n * Supported visit events: adding an item or viewing the bag.\n */\nexport type VisitEventName = \"add\" | \"bag\";\n\n/**\n * A visit event with its path, attribution and whether this event is a new step.\n */\nexport type VisitEvent = {\n event: VisitEventName;\n path: string;\n source: string;\n campaign: string;\n step: boolean;\n};\n\n/**\n * Page location, title, referrer and store name plus the storage used to track the visit.\n */\nexport type PageViewInput = {\n path: string;\n search: string;\n title: string;\n referrer: string;\n storeName: string;\n storage: VisitStorage;\n};\n\nfunction stored(storage: VisitStorage): Visit | null {\n try {\n const raw = storage.getItem(VISIT_KEY);\n if (raw) {\n return JSON.parse(raw) as Visit;\n }\n return null;\n } catch {\n return null;\n }\n}\n\nfunction save(storage: VisitStorage, visit: Visit): void {\n try {\n storage.setItem(VISIT_KEY, JSON.stringify(visit));\n } catch {\n // Without storage, each page is its own visit.\n }\n}\n\nfunction kindOf(path: string): string {\n if (path === \"/\") {\n return \"menu\";\n }\n if (path.startsWith(\"/item/\")) {\n return \"item\";\n }\n if (path === \"/cart\") {\n return \"bag\";\n }\n if (path === \"/checkout\") {\n return \"checkout\";\n }\n if (path.startsWith(\"/checkout/\")) {\n return \"payment\";\n }\n if (path.startsWith(\"/orders\")) {\n return \"order\";\n }\n return \"page\";\n}\n\nfunction reached(storage: VisitStorage, visit: Visit, kind: string): boolean {\n const steps = visit.steps ?? [];\n if (steps.includes(kind)) {\n return false;\n }\n visit.steps = [...steps, kind];\n save(storage, visit);\n return true;\n}\n\nfunction titleOf(title: string, storeName: string, path: string): string {\n const own = title\n .split(/\\s+[·|–-]\\s+/)\n .filter((part) => part.trim() && part.trim() !== storeName)\n .join(\" · \")\n .trim();\n if (own) {\n return own;\n }\n if (path === \"/\") {\n return \"Home\";\n }\n return \"\";\n}\n\n/**\n * Build a page-view payload and save visit attribution and reached steps in your storage.\n * On the first page, utm_source takes precedence over the referrer and utm_campaign supplies the campaign.\n *\n * @returns The payload with the store name removed from its title and visit/step flags. Does not send a request.\n */\nexport function pageView(input: PageViewInput): PageView {\n const { path, search, title, referrer, storeName, storage } = input;\n const known = stored(storage);\n let visit = known;\n if (!visit) {\n const query = new URLSearchParams(search);\n visit = {\n source: query.get(\"utm_source\") || referrer,\n campaign: query.get(\"utm_campaign\") || \"\",\n };\n save(storage, visit);\n }\n return {\n path,\n title: titleOf(title, storeName, path),\n source: visit.source,\n campaign: visit.campaign,\n new: known === null,\n step: reached(storage, visit, kindOf(path)),\n };\n}\n\n/**\n * Build a visit-event payload and record whether this event has already occurred in storage.\n * Uses stored attribution or empty strings. Does not send a request.\n */\nexport function visitEvent(\n event: VisitEventName,\n path: string,\n storage: VisitStorage,\n): VisitEvent {\n const visit = stored(storage) ?? { source: \"\", campaign: \"\" };\n return {\n event,\n path,\n source: visit.source,\n campaign: visit.campaign,\n step: reached(storage, visit, event),\n };\n}\n\n/**\n * Read the saved visit source and campaign from your storage, defaulting each to an empty string.\n */\nexport function visitSource(storage: VisitStorage): {\n source: string;\n campaign: string;\n} {\n const visit = stored(storage);\n return {\n source: visit?.source ?? \"\",\n campaign: visit?.campaign ?? \"\",\n };\n}\n","import {\n pageView,\n visitEvent,\n visitSource,\n type PageViewInput,\n type VisitEventName,\n type VisitStorage,\n} from \"./page-views\";\n\nexport {\n pageView,\n visitEvent,\n visitSource,\n type PageView,\n type PageViewInput,\n type VisitEvent,\n type VisitEventName,\n type VisitStorage,\n} from \"./page-views\";\n\n/**\n * Page-view details with an optional enabled flag. Browser session storage is supplied automatically.\n */\nexport type CountPageInput = Omit<PageViewInput, \"storage\"> & {\n enabled?: boolean;\n};\n\nlet counting = false;\n\nconst emptyStorage: VisitStorage = {\n getItem: () => null,\n setItem: () => undefined,\n};\n\nfunction session(): VisitStorage {\n try {\n return window.sessionStorage;\n } catch {\n return emptyStorage;\n }\n}\n\nfunction canSend(): boolean {\n return (\n typeof navigator !== \"undefined\" &&\n typeof navigator.sendBeacon === \"function\"\n );\n}\n\nfunction send(body: unknown): void {\n navigator.sendBeacon(\"/_zappie/view\", JSON.stringify(body));\n}\n\n/**\n * Record a page view in session storage and send it to /_zappie/view when sendBeacon is available.\n * Passing enabled: false disables this call and subsequent event counting until an enabled page is counted.\n */\nexport function countPage(input: CountPageInput): void {\n counting = false;\n if (input.enabled === false) {\n return;\n }\n const { enabled: _enabled, ...page } = input;\n // The visit is recorded even without a beacon, so checkout can still name its source.\n const view = pageView({ ...page, storage: session() });\n counting = true;\n if (canSend()) {\n send(view);\n }\n}\n\n/**\n * Send an add or bag event for the current path after countPage has enabled counting.\n * Does nothing without a browser window or sendBeacon support.\n */\nexport function countEvent(event: VisitEventName): void {\n if (!counting || typeof window === \"undefined\" || !canSend()) {\n return;\n }\n send(visitEvent(event, window.location.pathname, session()));\n}\n\n/**\n * Read visit attribution from browser session storage.\n * Returns empty source and campaign strings on the server or when no visit is stored.\n */\nexport function currentSource(): { source: string; campaign: string } {\n if (typeof window === \"undefined\") {\n return { source: \"\", campaign: \"\" };\n }\n return visitSource(session());\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,108 @@
1
1
  {
2
2
  "name": "@zappie/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Typed, framework-agnostic client for Zappie menus, carts, checkout, auth and events.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./internal": {
13
+ "types": "./dist/internal.d.ts",
14
+ "import": "./dist/internal.js"
15
+ },
16
+ "./config": {
17
+ "types": "./dist/config/index.d.ts",
18
+ "import": "./dist/config/index.js"
19
+ },
20
+ "./react": {
21
+ "types": "./dist/react/index.d.ts",
22
+ "import": "./dist/react/index.js"
23
+ },
24
+ "./server": {
25
+ "types": "./dist/server/index.d.ts",
26
+ "import": "./dist/server/index.js"
27
+ },
28
+ "./url": {
29
+ "types": "./dist/url/index.d.ts",
30
+ "import": "./dist/url/index.js"
31
+ },
32
+ "./testing": {
33
+ "types": "./dist/testing/index.d.ts",
34
+ "import": "./dist/testing/index.js"
35
+ },
36
+ "./cart/item": {
37
+ "types": "./dist/cart/item.d.ts",
38
+ "import": "./dist/cart/item.js"
39
+ },
40
+ "./checkout": {
41
+ "types": "./dist/checkout/index.d.ts",
42
+ "import": "./dist/checkout/index.js"
43
+ },
44
+ "./customer": {
45
+ "types": "./dist/customer/index.d.ts",
46
+ "import": "./dist/customer/index.js"
47
+ },
48
+ "./customer/react": {
49
+ "types": "./dist/customer/react.d.ts",
50
+ "import": "./dist/customer/react.js"
51
+ },
52
+ "./places": {
53
+ "types": "./dist/places/index.d.ts",
54
+ "import": "./dist/places/index.js"
55
+ },
56
+ "./visits": {
57
+ "types": "./dist/visits/index.d.ts",
58
+ "import": "./dist/visits/index.js"
59
+ },
60
+ "./template": {
61
+ "types": "./dist/template/index.d.ts",
62
+ "import": "./dist/template/index.js"
63
+ },
64
+ "./template/react": {
65
+ "types": "./dist/template/react.d.ts",
66
+ "import": "./dist/template/react.js"
67
+ },
68
+ "./persist/catalogue": {
69
+ "types": "./dist/persist/catalogue.d.ts",
70
+ "import": "./dist/persist/catalogue.js"
71
+ },
72
+ "./transport/selected-menu": {
73
+ "types": "./dist/transport/selected-menu.d.ts",
74
+ "import": "./dist/transport/selected-menu.js"
75
+ }
76
+ },
77
+ "publishConfig": {
78
+ "access": "public",
79
+ "provenance": false
80
+ },
81
+ "files": [
82
+ "dist",
83
+ "CHANGELOG.md"
84
+ ],
85
+ "peerDependencies": {
86
+ "react": "^18.2.0 || ^19.0.0"
87
+ },
88
+ "peerDependenciesMeta": {
89
+ "react": {
90
+ "optional": true
91
+ }
92
+ },
93
+ "repository": {
94
+ "type": "git",
95
+ "url": "git+https://github.com/zappie/storefront.git",
96
+ "directory": "packages/sdk"
97
+ },
98
+ "license": "MIT",
99
+ "homepage": "https://github.com/zappie/storefront#readme",
100
+ "bugs": {
101
+ "url": "https://github.com/zappie/storefront/issues"
102
+ },
103
+ "scripts": {
104
+ "build": "tsup && tsup --config tsup.checkout.config.ts && tsup --config tsup.customer.config.ts && tsup --config tsup.places.config.ts && tsup --config tsup.url.config.ts && tsup --config tsup.visits.config.ts && tsup --config tsup.site-config.config.ts && tsup --config tsup.template.config.ts",
105
+ "test": "vitest run --root ../.. packages/sdk/test",
106
+ "size": "size-limit"
107
+ }
6
108
  }