@salesforce/storefront-next-runtime 0.1.1 → 0.2.0-alpha.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 (61) hide show
  1. package/dist/DesignComponent.js +150 -0
  2. package/dist/DesignComponent.js.map +1 -0
  3. package/dist/DesignFrame.js +196 -0
  4. package/dist/DesignFrame.js.map +1 -0
  5. package/dist/DesignRegion.js +83 -0
  6. package/dist/DesignRegion.js.map +1 -0
  7. package/dist/apply-url-config.js +130 -0
  8. package/dist/apply-url-config.js.map +1 -0
  9. package/dist/component.types.d.ts +87 -0
  10. package/dist/component.types.d.ts.map +1 -0
  11. package/dist/config.d.ts +2 -0
  12. package/dist/config.js +0 -0
  13. package/dist/design-data.d.ts +983 -0
  14. package/dist/design-data.d.ts.map +1 -0
  15. package/dist/design-data.js +908 -0
  16. package/dist/design-data.js.map +1 -0
  17. package/dist/design-messaging.d.ts +2 -2
  18. package/dist/design-react-core.d.ts +50 -5
  19. package/dist/design-react-core.d.ts.map +1 -1
  20. package/dist/design-react-core.js +81 -2
  21. package/dist/design-react-core.js.map +1 -1
  22. package/dist/design-react.d.ts +20 -95
  23. package/dist/design-react.d.ts.map +1 -1
  24. package/dist/design-react.js +3 -485
  25. package/dist/design-styles.css +2 -1
  26. package/dist/design.d.ts +110 -2
  27. package/dist/design.d.ts.map +1 -0
  28. package/dist/events.d.ts +1 -1
  29. package/dist/index.d.ts +1110 -154
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/multi-site.d.ts +154 -0
  32. package/dist/multi-site.d.ts.map +1 -0
  33. package/dist/multi-site.js +393 -0
  34. package/dist/multi-site.js.map +1 -0
  35. package/dist/routing-app-wrapper.d.ts +18 -0
  36. package/dist/routing-app-wrapper.d.ts.map +1 -0
  37. package/dist/routing-app-wrapper.js +21 -0
  38. package/dist/routing-app-wrapper.js.map +1 -0
  39. package/dist/routing.d.ts +42 -0
  40. package/dist/routing.d.ts.map +1 -0
  41. package/dist/routing.js +171 -0
  42. package/dist/routing.js.map +1 -0
  43. package/dist/scapi.d.ts +69 -5
  44. package/dist/scapi.d.ts.map +1 -1
  45. package/dist/scapi.js +1 -1
  46. package/dist/scapi.js.map +1 -1
  47. package/dist/types.d.ts +40 -13289
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/types2.d.ts +13293 -0
  50. package/dist/types2.d.ts.map +1 -0
  51. package/dist/types3.d.ts +110 -0
  52. package/dist/types3.d.ts.map +1 -0
  53. package/dist/workspace.d.ts +46 -0
  54. package/dist/workspace.d.ts.map +1 -0
  55. package/dist/workspace.js +52 -0
  56. package/dist/workspace.js.map +1 -0
  57. package/package.json +44 -2
  58. package/dist/design-react.js.map +0 -1
  59. package/dist/index2.d.ts +0 -1171
  60. package/dist/index2.d.ts.map +0 -1
  61. /package/{LICENSE.txt → LICENSE} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-url-config.js","names":["prefixPatterns: string[]","excludedRoutes: RouteConfigEntry[]","includedRoutes: RouteConfigEntry[]","duplicates: RouteConfigEntry[]"],"sources":["../src/utils/index.ts","../src/multi-site/apply-url-config.ts"],"sourcesContent":["/**\n * Copyright 2026 Salesforce, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Creates a matcher function from an array of path patterns.\n * Supports `/**` suffix wildcards (e.g. '/resource/**', '/action/**').\n * Exact paths without wildcards are matched literally.\n */\nexport function createPatternMatcher(patterns: string[]): (path: string) => boolean {\n const exactMatches = new Set<string>();\n const prefixPatterns: string[] = [];\n\n for (const pattern of patterns) {\n if (pattern.endsWith('/**')) {\n prefixPatterns.push(pattern.slice(0, -3));\n } else {\n exactMatches.add(pattern);\n }\n }\n\n return (path: string) => {\n if (exactMatches.has(path)) return true;\n return prefixPatterns.some((prefix) => path === prefix || path.startsWith(`${prefix}/`));\n };\n}\n","/**\n * Copyright 2026 Salesforce, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { RouteConfigEntry } from '@react-router/dev/routes';\nimport { createPatternMatcher } from '../utils';\nimport type { Url } from '../config/types';\n\nconst DEFAULT_EXCLUDED_ROUTES = ['/resource/**', '/action/**'];\n\n/**\n * Separates routes into excluded (stay at root) and included (go under prefix).\n */\nexport function partitionRoutes(\n routes: RouteConfigEntry[],\n excludePatterns: string[]\n): { excludedRoutes: RouteConfigEntry[]; includedRoutes: RouteConfigEntry[] } {\n const isExcluded = createPatternMatcher(excludePatterns);\n const excludedRoutes: RouteConfigEntry[] = [];\n const includedRoutes: RouteConfigEntry[] = [];\n\n for (const route of routes) {\n // Normalize path for matching — ensure leading slash so patterns like '/resource/**' work\n // regardless of whether the route path comes with or without a leading slash.\n // E.g Some routes comes from React Router flatRoutes objects where the path has no leading splash\n const matchPath = route.path?.startsWith('/') ? route.path : `/${route.path}`;\n if (route.path && isExcluded(matchPath)) {\n excludedRoutes.push(route);\n } else {\n includedRoutes.push(route);\n }\n }\n\n return { excludedRoutes, includedRoutes };\n}\n\n/**\n * Normalizes route paths by stripping leading `/` so they're relative under a\n * parent route (React Router requirement).\n */\nexport function normalizeRoutePaths(routes: RouteConfigEntry[]): RouteConfigEntry[] {\n return routes.map((route) => ({\n ...route,\n // Check for leading splash because React Router route object can contain no leading splash for a child route\n // E.g Some routes comes from React Router flatRoutes objects where the path has no leading splash\n path: route.path?.startsWith('/') ? route.path.slice(1) : route.path,\n }));\n}\n\n/**\n * Creates the `multi-site-wrapper` parent route entry with the given prefix.\n */\nexport function createPrefixWrapper(\n prefix: string,\n children: RouteConfigEntry[],\n wrapperFile: string\n): RouteConfigEntry {\n return {\n id: 'multi-site-wrapper',\n file: wrapperFile,\n path: prefix.slice(1),\n children,\n };\n}\n\n/**\n * Finds the root index route (`/`) and duplicates it with its parent layout.\n * Looks at the top level for pathless layouts whose direct children include an index route.\n * e.g. _app (pathless) → _app._index (index: true)\n * Returns: _app--root-duplicate → _app._index--root-duplicate\n */\nexport function cloneRootIndexRoutes(routes: RouteConfigEntry[]): RouteConfigEntry[] {\n const duplicates: RouteConfigEntry[] = [];\n\n for (const route of routes) {\n if (route.index === true) {\n duplicates.push({\n ...route,\n id: `${route.id}--root-duplicate`,\n });\n } else if (!route.path && route.children) {\n const indexChild = route.children.find((child) => child.index === true);\n if (indexChild) {\n duplicates.push({\n ...route,\n id: `${route.id}--root-duplicate`,\n children: [{ ...indexChild, id: `${indexChild.id}--root-duplicate` }],\n });\n }\n }\n }\n\n return duplicates;\n}\n\n/**\n * Applies multi-site URL configuration to a set of route entries.\n *\n * Wraps non-excluded routes under a parent route with the configured URL prefix\n * (e.g. `/:siteId/:localeId`), while keeping excluded routes (action/resource by default)\n * at the root level. The homepage index route (and its parent layout) is always\n * duplicated at `/` so the root URL still serves content.\n *\n * @param options - Configuration for URL customisation.\n * @param options.routes - The flat route entries discovered from the filesystem.\n * @param options.urlConfig - URL customisation configuration (prefix, excludeRoutes).\n * @param options.wrapperFile - Path to the wrapper component file, relative to appDirectory.\n * @returns The transformed route entries with prefix wrapping applied.\n */\nexport function applyUrlConfig(options: {\n routes: RouteConfigEntry[];\n urlConfig?: Url;\n wrapperFile: string;\n}): RouteConfigEntry[] {\n const { routes, urlConfig, wrapperFile } = options;\n if (!urlConfig) return routes;\n if (!urlConfig.prefix?.startsWith('/')) {\n throw new Error(`urlConfig.prefix must start with a leading slash (\"/\"). Received: \"${urlConfig.prefix}\"`);\n }\n if (urlConfig.prefix === '/') return routes;\n\n const excludePatterns = urlConfig.excludeRoutes ?? DEFAULT_EXCLUDED_ROUTES;\n\n const { excludedRoutes, includedRoutes } = partitionRoutes(routes, excludePatterns);\n\n const wrappableRoutes = normalizeRoutePaths(includedRoutes);\n // the route that wraps the included routes under prefix\n const wrapperRoute = createPrefixWrapper(urlConfig.prefix, wrappableRoutes, wrapperFile);\n\n // duplicate the app root index to keep app homepage to server at '/'\n const rootDuplicates = cloneRootIndexRoutes(includedRoutes);\n\n return [...rootDuplicates, wrapperRoute, ...excludedRoutes];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,qBAAqB,UAA+C;CAChF,MAAM,+BAAe,IAAI,KAAa;CACtC,MAAMA,iBAA2B,EAAE;AAEnC,MAAK,MAAM,WAAW,SAClB,KAAI,QAAQ,SAAS,MAAM,CACvB,gBAAe,KAAK,QAAQ,MAAM,GAAG,GAAG,CAAC;KAEzC,cAAa,IAAI,QAAQ;AAIjC,SAAQ,SAAiB;AACrB,MAAI,aAAa,IAAI,KAAK,CAAE,QAAO;AACnC,SAAO,eAAe,MAAM,WAAW,SAAS,UAAU,KAAK,WAAW,GAAG,OAAO,GAAG,CAAC;;;;;;AChBhG,MAAM,0BAA0B,CAAC,gBAAgB,aAAa;;;;AAK9D,SAAgB,gBACZ,QACA,iBAC0E;CAC1E,MAAM,aAAa,qBAAqB,gBAAgB;CACxD,MAAMC,iBAAqC,EAAE;CAC7C,MAAMC,iBAAqC,EAAE;AAE7C,MAAK,MAAM,SAAS,QAAQ;EAIxB,MAAM,YAAY,MAAM,MAAM,WAAW,IAAI,GAAG,MAAM,OAAO,IAAI,MAAM;AACvE,MAAI,MAAM,QAAQ,WAAW,UAAU,CACnC,gBAAe,KAAK,MAAM;MAE1B,gBAAe,KAAK,MAAM;;AAIlC,QAAO;EAAE;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0,0 +1,87 @@
1
+ import React from "react";
2
+
3
+ //#region src/design/react/core/component.types.d.ts
4
+
5
+ /**
6
+ * Default component constructor interface.
7
+ * Used to define default components that should be instantiated in a region.
8
+ */
9
+ interface DefaultComponentConstructor {
10
+ /** Unique identifier for the component instance */
11
+ id: string;
12
+ /** Component type ID to instantiate */
13
+ typeId: string;
14
+ /** Component data/attributes */
15
+ data: Record<string, unknown>;
16
+ }
17
+ interface RegionDesignMetadata {
18
+ /**
19
+ * The id of the component or region.
20
+ */
21
+ id: string;
22
+ /**
23
+ * The name of the component or region.
24
+ */
25
+ name?: string;
26
+ /**
27
+ * Optional description for the region.
28
+ */
29
+ description?: string;
30
+ /**
31
+ * Maximum number of components allowed in the region.
32
+ */
33
+ maxComponents?: number;
34
+ /**
35
+ * A list of component ids that are part of this region.
36
+ */
37
+ componentIds?: string[];
38
+ /**
39
+ * A list of allowed component types in this region.
40
+ */
41
+ componentTypeInclusions?: string[];
42
+ /**
43
+ * A list of forbidden component types in this region.
44
+ */
45
+ componentTypeExclusions?: string[];
46
+ /**
47
+ * Default components to instantiate when the region is created.
48
+ */
49
+ defaultComponentConstructors?: DefaultComponentConstructor[];
50
+ }
51
+ interface ComponentDesignMetadata {
52
+ /**
53
+ * The id of the component or region.
54
+ */
55
+ id: string;
56
+ /**
57
+ * Whether the component is a fragment.
58
+ */
59
+ isFragment: boolean;
60
+ /**
61
+ * Whether the component is visible based on the current visiblity rules and context.
62
+ */
63
+ isVisible: boolean;
64
+ /**
65
+ * Whether the component has been localized in the current locale.
66
+ */
67
+ isLocalized: boolean;
68
+ /**
69
+ * The name of the component or region.
70
+ */
71
+ name?: string;
72
+ /**
73
+ * The region definitions for this component.
74
+ */
75
+ regionDefinitions?: RegionDesignMetadata[];
76
+ }
77
+ type ComponentDecoratorProps<TProps> = React.PropsWithChildren<{
78
+ designMetadata?: ComponentDesignMetadata;
79
+ visible?: boolean;
80
+ localized?: boolean;
81
+ } & TProps>;
82
+ type RegionDecoratorProps<TProps> = React.PropsWithChildren<{
83
+ designMetadata?: RegionDesignMetadata;
84
+ } & TProps>;
85
+ //#endregion
86
+ export { RegionDesignMetadata as a, RegionDecoratorProps as i, ComponentDesignMetadata as n, DefaultComponentConstructor as r, ComponentDecoratorProps as t };
87
+ //# sourceMappingURL=component.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.types.d.ts","names":[],"sources":["../src/design/react/core/component.types.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAqBiB,2BAAA;;;;;;QAMP;;UAGO,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAgCkB;;UAGlB,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;sBAwBO;;KAGZ,kCAAkC,KAAA,CAAM;mBAE3B;;;IAGjB;KAGI,+BAA+B,KAAA,CAAM;mBAExB;IACjB"}
@@ -0,0 +1,2 @@
1
+ import { n as Site, r as Url, t as Locale } from "./types.js";
2
+ export { type Locale, type Site, type Url };
package/dist/config.js ADDED
File without changes