@businessdash/sdk 0.9.60

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 (268) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +899 -0
  3. package/dist/adapters-revalidate.d.ts +44 -0
  4. package/dist/adapters-revalidate.d.ts.map +1 -0
  5. package/dist/adapters-revalidate.js +68 -0
  6. package/dist/adapters-revalidate.js.map +1 -0
  7. package/dist/alpha.d.ts +21 -0
  8. package/dist/alpha.d.ts.map +1 -0
  9. package/dist/alpha.js +21 -0
  10. package/dist/alpha.js.map +1 -0
  11. package/dist/analytics-core.d.ts +34 -0
  12. package/dist/analytics-core.d.ts.map +1 -0
  13. package/dist/analytics-core.js +138 -0
  14. package/dist/analytics-core.js.map +1 -0
  15. package/dist/analytics-server.d.ts +54 -0
  16. package/dist/analytics-server.d.ts.map +1 -0
  17. package/dist/analytics-server.js +78 -0
  18. package/dist/analytics-server.js.map +1 -0
  19. package/dist/attribution-logo.d.ts +2 -0
  20. package/dist/attribution-logo.d.ts.map +1 -0
  21. package/dist/attribution-logo.js +5 -0
  22. package/dist/attribution-logo.js.map +1 -0
  23. package/dist/auth-handler.d.ts +92 -0
  24. package/dist/auth-handler.d.ts.map +1 -0
  25. package/dist/auth-handler.js +277 -0
  26. package/dist/auth-handler.js.map +1 -0
  27. package/dist/biab-forms.css +484 -0
  28. package/dist/cli.d.ts +46 -0
  29. package/dist/cli.d.ts.map +1 -0
  30. package/dist/cli.js +1824 -0
  31. package/dist/cli.js.map +1 -0
  32. package/dist/client.d.ts +1681 -0
  33. package/dist/client.d.ts.map +1 -0
  34. package/dist/client.js +2845 -0
  35. package/dist/client.js.map +1 -0
  36. package/dist/collections.d.ts +13 -0
  37. package/dist/collections.d.ts.map +1 -0
  38. package/dist/collections.js +13 -0
  39. package/dist/collections.js.map +1 -0
  40. package/dist/contracts.d.ts +14609 -0
  41. package/dist/contracts.d.ts.map +1 -0
  42. package/dist/contracts.js +2428 -0
  43. package/dist/contracts.js.map +1 -0
  44. package/dist/data-model-schema.d.ts +962 -0
  45. package/dist/data-model-schema.d.ts.map +1 -0
  46. package/dist/data-model-schema.js +2295 -0
  47. package/dist/data-model-schema.js.map +1 -0
  48. package/dist/distribution.d.ts +38 -0
  49. package/dist/distribution.d.ts.map +1 -0
  50. package/dist/distribution.js +61 -0
  51. package/dist/distribution.js.map +1 -0
  52. package/dist/element.d.ts +121 -0
  53. package/dist/element.d.ts.map +1 -0
  54. package/dist/element.js +276 -0
  55. package/dist/element.js.map +1 -0
  56. package/dist/enums.d.ts +25 -0
  57. package/dist/enums.d.ts.map +1 -0
  58. package/dist/enums.js +38 -0
  59. package/dist/enums.js.map +1 -0
  60. package/dist/errors.d.ts +195 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +188 -0
  63. package/dist/errors.js.map +1 -0
  64. package/dist/forms-core/autocomplete.d.ts +37 -0
  65. package/dist/forms-core/autocomplete.d.ts.map +1 -0
  66. package/dist/forms-core/autocomplete.js +82 -0
  67. package/dist/forms-core/autocomplete.js.map +1 -0
  68. package/dist/forms-core/business-function.d.ts +61 -0
  69. package/dist/forms-core/business-function.d.ts.map +1 -0
  70. package/dist/forms-core/business-function.js +149 -0
  71. package/dist/forms-core/business-function.js.map +1 -0
  72. package/dist/forms-core/calculation.d.ts +72 -0
  73. package/dist/forms-core/calculation.d.ts.map +1 -0
  74. package/dist/forms-core/calculation.js +103 -0
  75. package/dist/forms-core/calculation.js.map +1 -0
  76. package/dist/forms-core/controller.d.ts +249 -0
  77. package/dist/forms-core/controller.d.ts.map +1 -0
  78. package/dist/forms-core/controller.js +590 -0
  79. package/dist/forms-core/controller.js.map +1 -0
  80. package/dist/forms-core/elements.d.ts +44 -0
  81. package/dist/forms-core/elements.d.ts.map +1 -0
  82. package/dist/forms-core/elements.js +68 -0
  83. package/dist/forms-core/elements.js.map +1 -0
  84. package/dist/forms-core/email-domains.d.ts +10 -0
  85. package/dist/forms-core/email-domains.d.ts.map +1 -0
  86. package/dist/forms-core/email-domains.js +69 -0
  87. package/dist/forms-core/email-domains.js.map +1 -0
  88. package/dist/forms-core/file-rules.d.ts +51 -0
  89. package/dist/forms-core/file-rules.d.ts.map +1 -0
  90. package/dist/forms-core/file-rules.js +105 -0
  91. package/dist/forms-core/file-rules.js.map +1 -0
  92. package/dist/forms-core/formula.d.ts +114 -0
  93. package/dist/forms-core/formula.d.ts.map +1 -0
  94. package/dist/forms-core/formula.js +1170 -0
  95. package/dist/forms-core/formula.js.map +1 -0
  96. package/dist/forms-core/index.d.ts +24 -0
  97. package/dist/forms-core/index.d.ts.map +1 -0
  98. package/dist/forms-core/index.js +28 -0
  99. package/dist/forms-core/index.js.map +1 -0
  100. package/dist/forms-core/units.d.ts +49 -0
  101. package/dist/forms-core/units.d.ts.map +1 -0
  102. package/dist/forms-core/units.js +255 -0
  103. package/dist/forms-core/units.js.map +1 -0
  104. package/dist/forms-core/us-states.d.ts +14 -0
  105. package/dist/forms-core/us-states.d.ts.map +1 -0
  106. package/dist/forms-core/us-states.js +66 -0
  107. package/dist/forms-core/us-states.js.map +1 -0
  108. package/dist/forms-core/validation.d.ts +266 -0
  109. package/dist/forms-core/validation.d.ts.map +1 -0
  110. package/dist/forms-core/validation.js +850 -0
  111. package/dist/forms-core/validation.js.map +1 -0
  112. package/dist/forms.d.ts +19 -0
  113. package/dist/forms.d.ts.map +1 -0
  114. package/dist/forms.js +29 -0
  115. package/dist/forms.js.map +1 -0
  116. package/dist/gallery-types.d.ts +32 -0
  117. package/dist/gallery-types.d.ts.map +1 -0
  118. package/dist/gallery-types.js +2 -0
  119. package/dist/gallery-types.js.map +1 -0
  120. package/dist/graphql.d.ts +97 -0
  121. package/dist/graphql.d.ts.map +1 -0
  122. package/dist/graphql.js +212 -0
  123. package/dist/graphql.js.map +1 -0
  124. package/dist/index.cjs +19448 -0
  125. package/dist/index.d.cts +19 -0
  126. package/dist/index.d.mts +19 -0
  127. package/dist/index.d.ts +19 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +20 -0
  130. package/dist/index.js.map +1 -0
  131. package/dist/marketing-schema.d.ts +216 -0
  132. package/dist/marketing-schema.d.ts.map +1 -0
  133. package/dist/marketing-schema.js +200 -0
  134. package/dist/marketing-schema.js.map +1 -0
  135. package/dist/mcp.d.ts +42 -0
  136. package/dist/mcp.d.ts.map +1 -0
  137. package/dist/mcp.js +87 -0
  138. package/dist/mcp.js.map +1 -0
  139. package/dist/native.d.ts +45 -0
  140. package/dist/native.d.ts.map +1 -0
  141. package/dist/native.js +43 -0
  142. package/dist/native.js.map +1 -0
  143. package/dist/next-revalidate.d.ts +43 -0
  144. package/dist/next-revalidate.d.ts.map +1 -0
  145. package/dist/next-revalidate.js +84 -0
  146. package/dist/next-revalidate.js.map +1 -0
  147. package/dist/parallel-pages.d.ts +102 -0
  148. package/dist/parallel-pages.d.ts.map +1 -0
  149. package/dist/parallel-pages.js +108 -0
  150. package/dist/parallel-pages.js.map +1 -0
  151. package/dist/payment-icons.d.ts +66 -0
  152. package/dist/payment-icons.d.ts.map +1 -0
  153. package/dist/payment-icons.js +160 -0
  154. package/dist/payment-icons.js.map +1 -0
  155. package/dist/proxy.d.ts +67 -0
  156. package/dist/proxy.d.ts.map +1 -0
  157. package/dist/proxy.js +97 -0
  158. package/dist/proxy.js.map +1 -0
  159. package/dist/react-analytics.d.ts +39 -0
  160. package/dist/react-analytics.d.ts.map +1 -0
  161. package/dist/react-analytics.js +59 -0
  162. package/dist/react-analytics.js.map +1 -0
  163. package/dist/react-attribution.d.ts +99 -0
  164. package/dist/react-attribution.d.ts.map +1 -0
  165. package/dist/react-attribution.js +52 -0
  166. package/dist/react-attribution.js.map +1 -0
  167. package/dist/react-marketing.d.ts +181 -0
  168. package/dist/react-marketing.d.ts.map +1 -0
  169. package/dist/react-marketing.js +215 -0
  170. package/dist/react-marketing.js.map +1 -0
  171. package/dist/react.d.ts +727 -0
  172. package/dist/react.d.ts.map +1 -0
  173. package/dist/react.js +2418 -0
  174. package/dist/react.js.map +1 -0
  175. package/dist/reserved-paths.d.ts +24 -0
  176. package/dist/reserved-paths.d.ts.map +1 -0
  177. package/dist/reserved-paths.js +60 -0
  178. package/dist/reserved-paths.js.map +1 -0
  179. package/dist/revalidate-verify.d.ts +30 -0
  180. package/dist/revalidate-verify.d.ts.map +1 -0
  181. package/dist/revalidate-verify.js +74 -0
  182. package/dist/revalidate-verify.js.map +1 -0
  183. package/dist/sdk.d.ts +678 -0
  184. package/dist/sdk.d.ts.map +1 -0
  185. package/dist/sdk.js +801 -0
  186. package/dist/sdk.js.map +1 -0
  187. package/dist/seo.d.ts +218 -0
  188. package/dist/seo.d.ts.map +1 -0
  189. package/dist/seo.js +309 -0
  190. package/dist/seo.js.map +1 -0
  191. package/dist/socials.d.ts +47 -0
  192. package/dist/socials.d.ts.map +1 -0
  193. package/dist/socials.js +172 -0
  194. package/dist/socials.js.map +1 -0
  195. package/dist/static.d.ts +14 -0
  196. package/dist/static.d.ts.map +1 -0
  197. package/dist/static.js +14 -0
  198. package/dist/static.js.map +1 -0
  199. package/dist/url-pattern.d.ts +47 -0
  200. package/dist/url-pattern.d.ts.map +1 -0
  201. package/dist/url-pattern.js +124 -0
  202. package/dist/url-pattern.js.map +1 -0
  203. package/dist/vanilla.d.ts +77 -0
  204. package/dist/vanilla.d.ts.map +1 -0
  205. package/dist/vanilla.js +903 -0
  206. package/dist/vanilla.js.map +1 -0
  207. package/openapi.json +13779 -0
  208. package/package.json +204 -0
  209. package/src/adapters-revalidate.ts +88 -0
  210. package/src/alpha.ts +89 -0
  211. package/src/analytics-core.ts +175 -0
  212. package/src/analytics-server.ts +99 -0
  213. package/src/angular/biab-form.component.ts +1443 -0
  214. package/src/angular/index.ts +26 -0
  215. package/src/attribution-logo.ts +5 -0
  216. package/src/auth-handler.ts +352 -0
  217. package/src/cli.ts +2517 -0
  218. package/src/client.ts +3578 -0
  219. package/src/collections.ts +101 -0
  220. package/src/contracts.ts +3390 -0
  221. package/src/data-model-schema.ts +4042 -0
  222. package/src/distribution.ts +73 -0
  223. package/src/element.ts +321 -0
  224. package/src/enums.ts +65 -0
  225. package/src/errors.ts +338 -0
  226. package/src/forms-core/autocomplete.ts +97 -0
  227. package/src/forms-core/business-function.ts +209 -0
  228. package/src/forms-core/calculation.ts +167 -0
  229. package/src/forms-core/controller.ts +922 -0
  230. package/src/forms-core/elements.ts +86 -0
  231. package/src/forms-core/email-domains.ts +68 -0
  232. package/src/forms-core/file-rules.ts +123 -0
  233. package/src/forms-core/formula.ts +1339 -0
  234. package/src/forms-core/index.ts +122 -0
  235. package/src/forms-core/units.ts +308 -0
  236. package/src/forms-core/us-states.ts +68 -0
  237. package/src/forms-core/validation.ts +1037 -0
  238. package/src/forms.ts +63 -0
  239. package/src/gallery-types.ts +31 -0
  240. package/src/graphql.ts +295 -0
  241. package/src/index.ts +505 -0
  242. package/src/marketing-schema.ts +395 -0
  243. package/src/mcp.ts +108 -0
  244. package/src/native.ts +73 -0
  245. package/src/next-revalidate.ts +124 -0
  246. package/src/parallel-pages.ts +192 -0
  247. package/src/payment-icons.ts +205 -0
  248. package/src/proxy.ts +173 -0
  249. package/src/qwik.tsx +1234 -0
  250. package/src/react-analytics.tsx +76 -0
  251. package/src/react-attribution.tsx +192 -0
  252. package/src/react-marketing.tsx +338 -0
  253. package/src/react.tsx +5495 -0
  254. package/src/reserved-paths.ts +65 -0
  255. package/src/revalidate-verify.ts +98 -0
  256. package/src/sdk.ts +1671 -0
  257. package/src/seo.ts +488 -0
  258. package/src/socials.ts +230 -0
  259. package/src/solid.tsx +1466 -0
  260. package/src/static.ts +21 -0
  261. package/src/styles/biab-forms.css +484 -0
  262. package/src/svelte/BiabForm.svelte +1069 -0
  263. package/src/svelte/context.ts +57 -0
  264. package/src/svelte/index.ts +79 -0
  265. package/src/url-pattern.ts +153 -0
  266. package/src/vanilla.ts +1290 -0
  267. package/src/vue/BiabForm.vue +1538 -0
  268. package/src/vue/index.ts +119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qB,CACpC,OAAO,EAAE,OAAO,GACd,qBAAqB,EAAE,CAyBzB"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Canonical social-profile support.
3
+ *
4
+ * The company profile (`storefrontMeta().socials`) is a free-form record keyed
5
+ * by BIAB's field keys (`meta`, `twitterX`, `tikTok`, …). Consumers kept
6
+ * re-implementing the key→icon→href mapping by hand and getting BIAB's exact
7
+ * keys wrong (e.g. mapping `facebook`/`x` and silently dropping `meta`/`twitterX`).
8
+ * This module is the single source of truth: every platform BIAB supports, in
9
+ * render order, with a stable icon slug + a handle→URL normalizer, plus alias
10
+ * resolution so older/lowercase spellings still match.
11
+ *
12
+ * `iconSlug` is a https://simpleicons.org slug (render it however you like —
13
+ * e.g. `https://cdn.simpleicons.org/<slug>`); `null` means there's no brand
14
+ * glyph, so fall back to a generic icon. For a drop-in React renderer that does
15
+ * this for you, see `SocialLinks` in `@businessdash/sdk/react`.
16
+ */
17
+ /** Every platform BIAB supports, in footer render order. */
18
+ export const SOCIAL_PLATFORMS = [
19
+ {
20
+ key: "meta",
21
+ label: "Facebook",
22
+ iconSlug: "facebook",
23
+ hrefPrefix: "https://facebook.com/",
24
+ },
25
+ {
26
+ key: "instagram",
27
+ label: "Instagram",
28
+ iconSlug: "instagram",
29
+ hrefPrefix: "https://instagram.com/",
30
+ },
31
+ { key: "twitterX", label: "X", iconSlug: "x", hrefPrefix: "https://x.com/" },
32
+ {
33
+ key: "tikTok",
34
+ label: "TikTok",
35
+ iconSlug: "tiktok",
36
+ hrefPrefix: "https://tiktok.com/@",
37
+ },
38
+ {
39
+ key: "youTube",
40
+ label: "YouTube",
41
+ iconSlug: "youtube",
42
+ hrefPrefix: "https://youtube.com/",
43
+ },
44
+ {
45
+ key: "linkedIn",
46
+ label: "LinkedIn",
47
+ iconSlug: "linkedin",
48
+ hrefPrefix: "https://linkedin.com/",
49
+ },
50
+ {
51
+ key: "pinterest",
52
+ label: "Pinterest",
53
+ iconSlug: "pinterest",
54
+ hrefPrefix: "https://pinterest.com/",
55
+ },
56
+ {
57
+ key: "threads",
58
+ label: "Threads",
59
+ iconSlug: "threads",
60
+ hrefPrefix: "https://threads.net/@",
61
+ },
62
+ { key: "bluesky", label: "Bluesky", iconSlug: "bluesky" },
63
+ { key: "mastodon", label: "Mastodon", iconSlug: "mastodon" },
64
+ { key: "truthSocial", label: "Truth Social", iconSlug: "truthsocial" },
65
+ { key: "googleBusiness", label: "Google", iconSlug: "google" },
66
+ { key: "yelp", label: "Yelp", iconSlug: "yelp" },
67
+ { key: "nextdoor", label: "Nextdoor", iconSlug: "nextdoor" },
68
+ { key: "angi", label: "Angi", iconSlug: null },
69
+ { key: "homeAdvisor", label: "HomeAdvisor", iconSlug: null },
70
+ { key: "houzz", label: "Houzz", iconSlug: "houzz" },
71
+ { key: "thumbtack", label: "Thumbtack", iconSlug: "thumbtack" },
72
+ { key: "bbb", label: "Better Business Bureau", iconSlug: null },
73
+ {
74
+ key: "whatsApp",
75
+ label: "WhatsApp",
76
+ iconSlug: "whatsapp",
77
+ hrefPrefix: "https://wa.me/",
78
+ },
79
+ { key: "discord", label: "Discord", iconSlug: "discord" },
80
+ { key: "substack", label: "Substack", iconSlug: "substack" },
81
+ { key: "reddit", label: "Reddit", iconSlug: "reddit" },
82
+ { key: "buyMeACoffee", label: "Buy Me a Coffee", iconSlug: "buymeacoffee" },
83
+ { key: "kofi", label: "Ko-fi", iconSlug: "kofi" },
84
+ { key: "patreon", label: "Patreon", iconSlug: "patreon" },
85
+ { key: "twitch", label: "Twitch", iconSlug: "twitch" },
86
+ { key: "vimeo", label: "Vimeo", iconSlug: "vimeo" },
87
+ {
88
+ key: "github",
89
+ label: "GitHub",
90
+ iconSlug: "github",
91
+ hrefPrefix: "https://github.com/",
92
+ },
93
+ { key: "behance", label: "Behance", iconSlug: "behance" },
94
+ { key: "dribbble", label: "Dribbble", iconSlug: "dribbble" },
95
+ ];
96
+ const PLATFORM_BY_KEY = new Map(SOCIAL_PLATFORMS.map((p) => [p.key.toLowerCase(), p]));
97
+ /** Older / alternate spellings → canonical key (all compared lowercased + de-punctuated). */
98
+ const ALIASES = {
99
+ facebook: "meta",
100
+ fb: "meta",
101
+ x: "twitterX",
102
+ twitter: "twitterX",
103
+ tiktok: "tikTok",
104
+ youtube: "youTube",
105
+ linkedin: "linkedIn",
106
+ google: "googleBusiness",
107
+ googlemybusiness: "googleBusiness",
108
+ truthsocial: "truthSocial",
109
+ homeadvisor: "homeAdvisor",
110
+ betterbusinessbureau: "bbb",
111
+ whatsapp: "whatsApp",
112
+ buymeacoffee: "buyMeACoffee",
113
+ "ko-fi": "kofi",
114
+ };
115
+ /** Strip case + separators so `Truth Social`, `truth_social`, `truthSocial` all collapse. */
116
+ function canonicalize(raw) {
117
+ return raw.toLowerCase().replace(/[\s_-]+/g, "");
118
+ }
119
+ /** Resolve any incoming social key (BIAB key, alias, or loose spelling) to its platform meta. */
120
+ export function resolveSocialPlatform(key) {
121
+ const c = canonicalize(key);
122
+ const direct = PLATFORM_BY_KEY.get(c);
123
+ if (direct)
124
+ return direct;
125
+ const aliased = ALIASES[c];
126
+ return aliased ? (PLATFORM_BY_KEY.get(aliased.toLowerCase()) ?? null) : null;
127
+ }
128
+ /** Turn a stored value (full URL or bare handle) into an href using the platform prefix. */
129
+ export function socialHref(value, platform) {
130
+ const v = value.trim();
131
+ if (/^(https?:\/\/|mailto:|tel:)/i.test(v))
132
+ return v;
133
+ if (platform.hrefPrefix)
134
+ return platform.hrefPrefix + v.replace(/^@/, "");
135
+ return `https://${v.replace(/^\/+/, "")}`;
136
+ }
137
+ /**
138
+ * Turn the company profile's `socials` record into a render-ready, de-duped list
139
+ * in canonical order — every platform that has a non-empty value, resolved to its
140
+ * label, icon slug, and a normalized URL. Empty values and unknown keys are
141
+ * dropped. Pass `storefrontMeta().socials` straight in.
142
+ */
143
+ export function resolveSocialProfiles(socials) {
144
+ if (!socials || typeof socials !== "object")
145
+ return [];
146
+ const present = new Map();
147
+ for (const [rawKey, rawVal] of Object.entries(socials)) {
148
+ if (typeof rawVal !== "string")
149
+ continue;
150
+ const value = rawVal.trim();
151
+ if (!value)
152
+ continue;
153
+ const platform = resolveSocialPlatform(rawKey);
154
+ if (!platform || present.has(platform.key))
155
+ continue;
156
+ present.set(platform.key, value);
157
+ }
158
+ const rows = [];
159
+ for (const platform of SOCIAL_PLATFORMS) {
160
+ const value = present.get(platform.key);
161
+ if (!value)
162
+ continue;
163
+ rows.push({
164
+ key: platform.key,
165
+ label: platform.label,
166
+ iconSlug: platform.iconSlug,
167
+ url: socialHref(value, platform),
168
+ });
169
+ }
170
+ return rows;
171
+ }
172
+ //# sourceMappingURL=socials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socials.js","sourceRoot":"","sources":["../src/socials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA8CH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAkC;IAC9D;QACC,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,uBAAuB;KACnC;IACD;QACC,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,WAAW;QACrB,UAAU,EAAE,wBAAwB;KACpC;IACD,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,gBAAgB,EAAE;IAC5E;QACC,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,sBAAsB;KAClC;IACD;QACC,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,sBAAsB;KAClC;IACD;QACC,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,uBAAuB;K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AC;SAChC,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@businessdash/sdk/static` — static data utilities and type helpers.
3
+ *
4
+ * Use this entrypoint for type‑safe enum / choice declarations and any other
5
+ * compile‑time static data definitions that ship with your collections.
6
+ *
7
+ * ```ts
8
+ * import { Enums } from "@businessdash/sdk/static";
9
+ *
10
+ * const Status = Enums(["active", "inactive"] as const);
11
+ * ```
12
+ */
13
+ export { type DefineEnums, type Enum, type EnumEntry, Enums, type InferEnum, type InferEnumValues, } from "./enums.js";
14
+ //# sourceMappingURL=static.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,EACL,KAAK,SAAS,EACd,KAAK,eAAe,GACpB,MAAM,YAAY,CAAC"}
package/dist/static.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@businessdash/sdk/static` — static data utilities and type helpers.
3
+ *
4
+ * Use this entrypoint for type‑safe enum / choice declarations and any other
5
+ * compile‑time static data definitions that ship with your collections.
6
+ *
7
+ * ```ts
8
+ * import { Enums } from "@businessdash/sdk/static";
9
+ *
10
+ * const Status = Enums(["active", "inactive"] as const);
11
+ * ```
12
+ */
13
+ export { Enums, } from "./enums.js";
14
+ //# sourceMappingURL=static.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static.js","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAIN,KAAK,GAGL,MAAM,YAAY,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * URL pattern parser + variant enumeration for parallel pages.
3
+ *
4
+ * A pattern is a string like `"/repair/[service]/[area]"`. Each
5
+ * `[name]` segment is a variable slot. The parser extracts the
6
+ * variable names + validates them against a binding map; the
7
+ * enumerator computes the cartesian product of variable values into
8
+ * concrete URLs.
9
+ *
10
+ * Pure functions — no I/O, no React, no DB. Safe to import from
11
+ * both server and client bundles.
12
+ */
13
+ export type ParallelPagePatternSegment = {
14
+ kind: "literal";
15
+ value: string;
16
+ } | {
17
+ kind: "variable";
18
+ name: string;
19
+ };
20
+ export type ParsedParallelPagePattern = {
21
+ pattern: string;
22
+ segments: ParallelPagePatternSegment[];
23
+ variableNames: string[];
24
+ };
25
+ /**
26
+ * Parse a `routePattern` into ordered segments. Throws on malformed
27
+ * input — the SDK + tRPC router both call this at write time so the
28
+ * row never persists an unparseable pattern.
29
+ */
30
+ export declare function parseParallelPagePattern(pattern: string): ParsedParallelPagePattern;
31
+ /**
32
+ * Materialise a single variant URL given the resolved slug values
33
+ * (`{ service: "garage-door", area: "saint-paul" }` → "/repair/garage-door/saint-paul").
34
+ */
35
+ export declare function materialiseParallelPagePath(parsed: ParsedParallelPagePattern, values: Readonly<Record<string, string>>): string;
36
+ /**
37
+ * Enumerate the cartesian product of variable values into a flat
38
+ * array of variant maps. Order: each input value array is iterated
39
+ * in turn, with the LAST variable's values cycling fastest — so the
40
+ * result is stable + diffable across reads (useful for sitemaps and
41
+ * `generateStaticParams`).
42
+ *
43
+ * Returns an empty array when ANY variable has zero values (the
44
+ * cartesian product of a zero-length axis is empty).
45
+ */
46
+ export declare function enumerateParallelPageVariants(variableNames: readonly string[], valuesByVariable: Readonly<Record<string, ReadonlyArray<string>>>): Array<Record<string, string>>;
47
+ //# sourceMappingURL=url-pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-pattern.d.ts","sourceRoot":"","sources":["../src/url-pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,0BAA0B,GACnC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,MAAM,MAAM,yBAAyB,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,aAAa,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AASF;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,OAAO,EAAE,MAAM,GACb,yBAAyB,CAyC3B;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,yBAAyB,EACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACtC,MAAM,CAgBR;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC5C,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,GAC/D,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkC/B"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * URL pattern parser + variant enumeration for parallel pages.
3
+ *
4
+ * A pattern is a string like `"/repair/[service]/[area]"`. Each
5
+ * `[name]` segment is a variable slot. The parser extracts the
6
+ * variable names + validates them against a binding map; the
7
+ * enumerator computes the cartesian product of variable values into
8
+ * concrete URLs.
9
+ *
10
+ * Pure functions — no I/O, no React, no DB. Safe to import from
11
+ * both server and client bundles.
12
+ */
13
+ /**
14
+ * Allowed variable-name characters — lowercase letters, digits, and
15
+ * hyphens / underscores so `[snow-removal]` and `[event_kind]` work.
16
+ * Matches the regex used by Next.js dynamic-route segments.
17
+ */
18
+ const VARIABLE_NAME = /^[a-z][a-z0-9_-]*$/;
19
+ /**
20
+ * Parse a `routePattern` into ordered segments. Throws on malformed
21
+ * input — the SDK + tRPC router both call this at write time so the
22
+ * row never persists an unparseable pattern.
23
+ */
24
+ export function parseParallelPagePattern(pattern) {
25
+ if (typeof pattern !== "string" || pattern.length === 0) {
26
+ throw new Error("Pattern must be a non-empty string.");
27
+ }
28
+ if (!pattern.startsWith("/")) {
29
+ throw new Error(`Pattern must start with "/" — got ${JSON.stringify(pattern)}.`);
30
+ }
31
+ const parts = pattern.slice(1).split("/");
32
+ const segments = [];
33
+ const variableNames = [];
34
+ const seen = new Set();
35
+ for (const part of parts) {
36
+ if (part.length === 0) {
37
+ throw new Error(`Pattern contains an empty segment (double slash?) — ${JSON.stringify(pattern)}.`);
38
+ }
39
+ const variableMatch = /^\[([^\]]+)\]$/.exec(part);
40
+ if (!variableMatch) {
41
+ segments.push({ kind: "literal", value: part });
42
+ continue;
43
+ }
44
+ const name = variableMatch[1] ?? "";
45
+ if (!VARIABLE_NAME.test(name)) {
46
+ throw new Error(`Variable segment "[${name}]" is not a valid identifier ` +
47
+ "(use lowercase letters, digits, hyphens, underscores).");
48
+ }
49
+ if (seen.has(name)) {
50
+ throw new Error(`Variable "[${name}]" appears more than once in ${JSON.stringify(pattern)}.`);
51
+ }
52
+ seen.add(name);
53
+ variableNames.push(name);
54
+ segments.push({ kind: "variable", name });
55
+ }
56
+ return { pattern, segments, variableNames };
57
+ }
58
+ /**
59
+ * Materialise a single variant URL given the resolved slug values
60
+ * (`{ service: "garage-door", area: "saint-paul" }` → "/repair/garage-door/saint-paul").
61
+ */
62
+ export function materialiseParallelPagePath(parsed, values) {
63
+ const out = [];
64
+ for (const seg of parsed.segments) {
65
+ if (seg.kind === "literal") {
66
+ out.push(seg.value);
67
+ continue;
68
+ }
69
+ const v = values[seg.name];
70
+ if (v === undefined || v === null || v === "") {
71
+ throw new Error(`Missing value for "[${seg.name}]" when materialising ${parsed.pattern}.`);
72
+ }
73
+ out.push(encodeURIComponent(v));
74
+ }
75
+ return `/${out.join("/")}`;
76
+ }
77
+ /**
78
+ * Enumerate the cartesian product of variable values into a flat
79
+ * array of variant maps. Order: each input value array is iterated
80
+ * in turn, with the LAST variable's values cycling fastest — so the
81
+ * result is stable + diffable across reads (useful for sitemaps and
82
+ * `generateStaticParams`).
83
+ *
84
+ * Returns an empty array when ANY variable has zero values (the
85
+ * cartesian product of a zero-length axis is empty).
86
+ */
87
+ export function enumerateParallelPageVariants(variableNames, valuesByVariable) {
88
+ if (variableNames.length === 0)
89
+ return [{}];
90
+ for (const name of variableNames) {
91
+ const list = valuesByVariable[name];
92
+ if (!list) {
93
+ throw new Error(`Missing value array for variable "${name}". ` +
94
+ `Provide one entry in valuesByVariable for every variable in the pattern.`);
95
+ }
96
+ if (list.length === 0)
97
+ return [];
98
+ }
99
+ const out = [];
100
+ const indices = variableNames.map(() => 0);
101
+ while (true) {
102
+ const variant = {};
103
+ for (let i = 0; i < variableNames.length; i++) {
104
+ const name = variableNames[i];
105
+ const idx = indices[i];
106
+ variant[name] = valuesByVariable[name][idx];
107
+ }
108
+ out.push(variant);
109
+ // Increment indices like an odometer (last variable cycles
110
+ // fastest). When the first variable rolls over, we're done.
111
+ let i = variableNames.length - 1;
112
+ while (i >= 0) {
113
+ indices[i] = indices[i] + 1;
114
+ if (indices[i] < valuesByVariable[variableNames[i]].length)
115
+ break;
116
+ indices[i] = 0;
117
+ i--;
118
+ }
119
+ if (i < 0)
120
+ break;
121
+ }
122
+ return out;
123
+ }
124
+ //# sourceMappingURL=url-pattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-pattern.js","sourceRoot":"","sources":["../src/url-pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH;;;;GAIG;AACH,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACvC,OAAe;IAEf,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACxD,CAAC;IACD,IA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Z,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * `@businessdash/sdk/vanilla` — framework-free imperative DOM binding for `<BiabForm>`.
3
+ *
4
+ * `mountBiabForm(elOrSelector, opts)` mounts a fully-rendered, schema-driven form
5
+ * into any DOM node. It owns nothing of the form's logic — all of that lives in
6
+ * the headless `createFormController` core (`@businessdash/sdk/forms`). This binding
7
+ * is the "render layer": it subscribes to the controller's `snapshot()` and, on
8
+ * every notify, rebuilds the form's DOM by walking `snapshot.visibleFields` and
9
+ * dispatching per field `type`. It is a faithful port of the dashboard renderer
10
+ * (`FormPreview.tsx`) so a drop-in `<biab-form>` reproduces the builder preview.
11
+ *
12
+ * Rendering rules (kept identical to the dashboard):
13
+ * - Light DOM, no shadow root, so the consumer's CSS cascades straight in.
14
+ * - Stable `biab-*` class hooks + `data-biab-*` attributes on every node.
15
+ * - Applies `schema.settings`: animation (none/fade/slide/scale/scroll),
16
+ * multi-step ("consecutive") nav, progress bar/steps, concurrent-reveal
17
+ * gating inside groups, plus the org icon when `showOrgIcon` is set.
18
+ * - condition_block / or_condition / input_group / flex_row layout nodes are
19
+ * walked exactly as the core's validation helpers expect.
20
+ *
21
+ * Compiled to dist (plain TS, no JSX). The web-component binding
22
+ * (`@businessdash/sdk/element`) wraps this same `mountBiabForm`.
23
+ */
24
+ import { type FormController, type FormData, type FormSubmitOptions } from "./forms-core/index.js";
25
+ import type { BiabClient, FormSchema, FormSubmitResult } from "./sdk.js";
26
+ export * from "./forms-core/index.js";
27
+ export interface MountBiabFormOptions {
28
+ /** The SDK client. Required unless `schema` is supplied (SSR / pre-fetched).
29
+ * Still used for `submit` / `uploadFile` when both are given. */
30
+ client?: BiabClient;
31
+ /** Form slug. Required when loading via `client`. */
32
+ slug?: string;
33
+ /** Pre-fetched schema (SSR). `load()` adopts it synchronously. */
34
+ schema?: FormSchema;
35
+ /** Label for the final submit button. Default "Submit". */
36
+ submitLabel?: string;
37
+ /** Validate on the server but store nothing (no side effects). */
38
+ dryRun?: boolean;
39
+ /** Extra class(es) added to the root `.biab-form` element. */
40
+ class?: string;
41
+ /** Alias for `class` — accepted for cross-framework parity. */
42
+ className?: string;
43
+ /** Default submit options merged into every submit (call opts win). */
44
+ submitOptions?: FormSubmitOptions;
45
+ /** Global HTML autofill switch. Omit to infer a sensible `autocomplete`
46
+ * token per field; `false` emits `autocomplete="off"` on every input. */
47
+ autoComplete?: boolean;
48
+ /** Per-field autofill overrides keyed by field id: a literal token,
49
+ * `true` (infer), or `false` (off). Wins over the global switch. */
50
+ fieldAutoComplete?: Record<string, string | boolean>;
51
+ /** Fired with the working values when the user submits (before the network
52
+ * round-trip is mapped to a result). Convenience for simple consumers. */
53
+ onSubmit?: (data: FormData) => void;
54
+ /** Fired after a successful submit. */
55
+ onSuccess?: (result: Extract<FormSubmitResult, {
56
+ ok: true;
57
+ }>) => void;
58
+ /** Fired after a failed submit. */
59
+ onError?: (result: Extract<FormSubmitResult, {
60
+ ok: false;
61
+ }>) => void;
62
+ }
63
+ /** Handle returned by `mountBiabForm` — drive or tear down the mounted form. */
64
+ export interface BiabFormInstance {
65
+ /** The underlying headless controller (advanced use). */
66
+ controller: FormController;
67
+ /** Re-fetch (or re-adopt) the schema and re-render. */
68
+ reload(): Promise<void>;
69
+ /** Programmatically submit (same as clicking the submit button). */
70
+ submit(options?: FormSubmitOptions): Promise<FormSubmitResult>;
71
+ /** Reset values / errors / step and re-render. */
72
+ reset(): void;
73
+ /** Unsubscribe, stop the controller, and clear the host element. */
74
+ destroy(): void;
75
+ }
76
+ export declare function mountBiabForm(elOrSelector: Element | string, opts: MountBiabFormOptions): BiabFormInstance;
77
+ //# sourceMappingURL=vanilla.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vanilla.d.ts","sourceRoot":"","sources":["../src/vanilla.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,OAAO,EAKN,KAAK,cAAc,EAEnB,KAAK,QAAQ,EAEb,KAA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