@salesforce/storefront-next-runtime 0.4.2 → 1.0.0-alpha.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 (87) hide show
  1. package/README.md +9 -3
  2. package/dist/ComponentContext.js +199 -4
  3. package/dist/ComponentContext.js.map +1 -1
  4. package/dist/DesignComponent.js +2 -2
  5. package/dist/DesignRegion.js +2 -2
  6. package/dist/RegionContext.js +9 -0
  7. package/dist/RegionContext.js.map +1 -0
  8. package/dist/component.types.d.ts +1 -1
  9. package/dist/config.d.ts +34 -221
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +35 -116
  12. package/dist/config.js.map +1 -1
  13. package/dist/data-store.d.ts +185 -15
  14. package/dist/data-store.d.ts.map +1 -1
  15. package/dist/data-store.js +412 -10
  16. package/dist/data-store.js.map +1 -1
  17. package/dist/defaults.d.ts +106 -0
  18. package/dist/defaults.d.ts.map +1 -0
  19. package/dist/defaults.js +67 -0
  20. package/dist/defaults.js.map +1 -0
  21. package/dist/design-data.d.ts +238 -356
  22. package/dist/design-data.d.ts.map +1 -1
  23. package/dist/design-data.js +459 -30
  24. package/dist/design-data.js.map +1 -1
  25. package/dist/design-mode.d.ts +3 -2
  26. package/dist/design-mode.d.ts.map +1 -1
  27. package/dist/design-react-core.d.ts +5 -15
  28. package/dist/design-react-core.d.ts.map +1 -1
  29. package/dist/design-react-core.js +2 -2
  30. package/dist/design-react.d.ts +2 -2
  31. package/dist/design.d.ts +2 -2
  32. package/dist/events.d.ts +32 -6
  33. package/dist/events.d.ts.map +1 -1
  34. package/dist/i18n-client.d.ts.map +1 -1
  35. package/dist/i18n-client.js.map +1 -1
  36. package/dist/i18n.d.ts +1 -2
  37. package/dist/i18n.d.ts.map +1 -1
  38. package/dist/modeDetection.js +0 -18
  39. package/dist/modeDetection.js.map +1 -1
  40. package/dist/scapi.d.ts +2185 -466
  41. package/dist/scapi.d.ts.map +1 -1
  42. package/dist/scapi.js +1 -1
  43. package/dist/scapi.js.map +1 -1
  44. package/dist/schema.d.ts +17 -15
  45. package/dist/schema.d.ts.map +1 -1
  46. package/dist/security-react.d.ts +34 -0
  47. package/dist/security-react.d.ts.map +1 -0
  48. package/dist/security-react.js +21 -0
  49. package/dist/security-react.js.map +1 -0
  50. package/dist/security.d.ts +61 -0
  51. package/dist/security.d.ts.map +1 -0
  52. package/dist/security.js +304 -0
  53. package/dist/security.js.map +1 -0
  54. package/dist/site-context.d.ts +43 -27
  55. package/dist/site-context.d.ts.map +1 -1
  56. package/dist/site-context.js +2 -2
  57. package/dist/site-context2.js +41 -31
  58. package/dist/site-context2.js.map +1 -1
  59. package/dist/types.d.ts +19 -3
  60. package/dist/types.d.ts.map +1 -1
  61. package/dist/types2.d.ts +89 -63
  62. package/dist/types2.d.ts.map +1 -1
  63. package/dist/types3.d.ts +1 -35
  64. package/dist/types3.d.ts.map +1 -1
  65. package/package.json +15 -20
  66. package/dist/DesignFrame.js +0 -204
  67. package/dist/DesignFrame.js.map +0 -1
  68. package/dist/custom-global-preferences.d.ts +0 -20
  69. package/dist/custom-global-preferences.d.ts.map +0 -1
  70. package/dist/custom-global-preferences.js +0 -31
  71. package/dist/custom-global-preferences.js.map +0 -1
  72. package/dist/custom-site-preferences.d.ts +0 -20
  73. package/dist/custom-site-preferences.d.ts.map +0 -1
  74. package/dist/custom-site-preferences.js +0 -31
  75. package/dist/custom-site-preferences.js.map +0 -1
  76. package/dist/data-store-custom-global-preferences.d.ts +0 -2
  77. package/dist/data-store-custom-global-preferences.js +0 -6
  78. package/dist/data-store-custom-site-preferences.d.ts +0 -2
  79. package/dist/data-store-custom-site-preferences.js +0 -6
  80. package/dist/data-store-gcp-preferences.d.ts +0 -2
  81. package/dist/data-store-gcp-preferences.js +0 -6
  82. package/dist/gcp-preferences.d.ts +0 -52
  83. package/dist/gcp-preferences.d.ts.map +0 -1
  84. package/dist/gcp-preferences.js +0 -64
  85. package/dist/gcp-preferences.js.map +0 -1
  86. package/dist/utils.js +0 -90
  87. package/dist/utils.js.map +0 -1
@@ -1,204 +0,0 @@
1
- import { a as useDesignState, r as useDesignContext } from "./DesignContext.js";
2
- import React from "react";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
-
5
- //#region src/design/react/hooks/useNodeToTargetStore.ts
6
- function useNodeToTargetStore({ parentId, componentId, contentLinkUuid, regionId, nodeRef, type, contentLinkUuids, componentTypeInclusions, componentTypeExclusions }) {
7
- const { nodeToTargetMap } = useDesignState();
8
- React.useEffect(() => {
9
- if (nodeRef.current) nodeToTargetMap.set(nodeRef.current, {
10
- parentId,
11
- componentId,
12
- contentLinkUuid,
13
- regionId,
14
- type,
15
- contentLinkUuids,
16
- componentTypeInclusions,
17
- componentTypeExclusions
18
- });
19
- }, [
20
- nodeRef,
21
- parentId,
22
- componentId,
23
- contentLinkUuid,
24
- regionId,
25
- type,
26
- contentLinkUuids,
27
- nodeToTargetMap,
28
- componentTypeInclusions,
29
- componentTypeExclusions
30
- ]);
31
- }
32
-
33
- //#endregion
34
- //#region src/design/react/hooks/useComponentType.ts
35
- function useComponentType(componentId) {
36
- const { pageDesignerConfig } = useDesignContext();
37
- const { type = "" } = pageDesignerConfig?.components[componentId] ?? {};
38
- return pageDesignerConfig?.componentTypes[type] ?? null;
39
- }
40
-
41
- //#endregion
42
- //#region src/design/react/components/DeleteToolboxButton.tsx
43
- const DeleteToolboxButton = ({ title, onClick, onMouseDown = () => {} }) => /* @__PURE__ */ jsx("button", {
44
- className: "pd-design__frame__toolbox-button",
45
- title,
46
- type: "button",
47
- onMouseDown,
48
- onClick,
49
- children: /* @__PURE__ */ jsx("svg", {
50
- className: "pd-design__frame__delete-icon",
51
- viewBox: "0 0 24 24",
52
- fill: "none",
53
- xmlns: "http://www.w3.org/2000/svg",
54
- children: /* @__PURE__ */ jsx("path", {
55
- d: "M18 6L6 18M6 6l12 12",
56
- stroke: "currentColor",
57
- strokeWidth: "2",
58
- strokeLinecap: "round",
59
- strokeLinejoin: "round"
60
- })
61
- })
62
- });
63
-
64
- //#endregion
65
- //#region src/design/react/components/MoveToolboxButton.tsx
66
- const MoveToolboxButton = ({ title }) => /* @__PURE__ */ jsx("button", {
67
- className: "pd-design__frame__toolbox-button",
68
- title,
69
- type: "button",
70
- children: /* @__PURE__ */ jsx("svg", {
71
- className: "pd-design__frame__move-icon",
72
- viewBox: "0 0 24 24",
73
- xmlns: "http://www.w3.org/2000/svg",
74
- children: /* @__PURE__ */ jsx("path", {
75
- d: "M22.9 11.7l-3.8-4.2c-.3-.3-.6 0-.6.4v2.7h-4.7c-.2 0-.4-.2-.4-.4V5.5h2.7c.5 0 .7-.4.4-.6l-4.1-3.8c-.2-.2-.5-.2-.7 0L7.6 4.9c-.3.3-.1.6.4.6h2.6v4.7c0 .2-.2.4-.4.4H5.5V7.9c0-.5-.4-.7-.6-.4l-3.8 4.1c-.2.2-.2.5 0 .7l3.8 4.1c.3.3.6.1.6-.4v-2.6h4.7c.2 0 .4.2.4.4v4.7H7.9c-.5 0-.7.4-.4.6l4.1 3.8c.2.2.5.2.7 0l4.1-3.8c.3-.3.1-.6-.4-.6h-2.6v-4.7c0-.2.2-.4.4-.4h4.7v2.7c0 .5.4.7.6.4l3.8-4.1c.2-.3.2-.5 0-.7z",
76
- stroke: "currentColor",
77
- strokeWidth: "2",
78
- strokeLinecap: "round",
79
- strokeLinejoin: "round"
80
- })
81
- })
82
- });
83
-
84
- //#endregion
85
- //#region src/design/react/hooks/useLabels.ts
86
- function useLabels() {
87
- const { pageDesignerConfig } = useDesignContext();
88
- return pageDesignerConfig?.labels ?? {};
89
- }
90
-
91
- //#endregion
92
- //#region src/design/react/components/DesignOverlay.tsx
93
- /**
94
- * Copyright 2026 Salesforce, Inc.
95
- *
96
- * Licensed under the Apache License, Version 2.0 (the "License");
97
- * you may not use this file except in compliance with the License.
98
- * You may obtain a copy of the License at
99
- *
100
- * http://www.apache.org/licenses/LICENSE-2.0
101
- *
102
- * Unless required by applicable law or agreed to in writing, software
103
- * distributed under the License is distributed on an "AS IS" BASIS,
104
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
105
- * See the License for the specific language governing permissions and
106
- * limitations under the License.
107
- */
108
- const DesignOverlay = () => {
109
- return /* @__PURE__ */ jsx("div", {
110
- className: "pd-design__frame__overlay",
111
- children: /* @__PURE__ */ jsx("svg", {
112
- xmlns: "http://www.w3.org/2000/svg",
113
- x: "0px",
114
- y: "0px",
115
- width: "52px",
116
- height: "52px",
117
- viewBox: "0 0 52 52",
118
- enableBackground: "new 0 0 52 52",
119
- xmlSpace: "preserve",
120
- children: /* @__PURE__ */ jsx("path", {
121
- fill: "#FFFFFF",
122
- d: "M26,2C12.7,2,2,12.7,2,26s10.7,24,24,24s24-10.7,24-24S39.3,2,26,2z M26,7C26,7,26,7,26,7C26,7,26,7,26,7\n C26,7,26,7,26,7z M28,7.1c-0.1,0-0.1,0-0.2,0C27.9,7.1,28,7.1,28,7.1z M26,45C15.5,45,7,36.5,7,26c0-1,0.1-2.1,0.3-3\n c1.3,0.2,2.9,0.7,3.7,1.5c1.7,1.8,3.6,3.9,5.4,4.3c0,0-0.2,0.1-0.4,0.4c-0.2,0.3-0.4,0.9-0.4,1.9c0,4.7,4.4,1.9,4.4,6.6\n c0,4.7,5.3,6.6,5.3,2.8s3.5-5.6,3.5-8.5s-2.7-2.8-4.4-3.8c-1.8-0.9-2.7-2.4-6.1-1.9c-1.8-1.7-2.8-3.1-2-4.7c0.9-1.7,4.6-2,4.6-4.6\n s-2.5-3.1-4.3-3.1c-0.8,0-2.5-0.6-3.9-1.3c1.7-1.7,3.8-3.1,6-4.1c1.6,0.7,4.3,1.8,6.6,1.8c2.7,0,4.1-1.9,3.7-3.1\n c4.5,0.7,8.5,3,11.4,6.2c-1.5,0.9-3.5,1.9-7,1.9c-4.6,0-4.6,4.7-1.9,5.6c2.8,0.9,5.6-1.8,6.5,0c0.9,1.8-6.5,1.8-4.6,6.4\n c1.9,4.6,3.7-0.1,5.6,4.5c1.9,4.6,5.6-0.7,2.8-4.3c-1.2-1.6-0.9-6.5,1.9-6.5h0.9c0.4,1.6,0.7,3.3,0.7,5C45,36.5,36.5,45,26,45z"
123
- })
124
- })
125
- });
126
- };
127
-
128
- //#endregion
129
- //#region src/design/react/components/DesignFrame.tsx
130
- const DesignFrame = ({ componentId, children, name, parentId, regionId, contentLinkUuid, localized = false, showFrame = false, showToolbox = true, isMoveable = true, className }) => {
131
- const componentType = useComponentType(componentId ?? "");
132
- const { deleteComponent } = useDesignState();
133
- const labels = useLabels();
134
- const nodeRef = React.useRef(null);
135
- const handleDelete = React.useCallback((event) => {
136
- event.stopPropagation();
137
- if (componentId) deleteComponent({
138
- componentId,
139
- contentLinkUuid: contentLinkUuid ?? "",
140
- sourceComponentId: parentId ?? "",
141
- sourceRegionId: regionId ?? ""
142
- });
143
- }, [
144
- deleteComponent,
145
- componentId,
146
- contentLinkUuid,
147
- parentId,
148
- regionId
149
- ]);
150
- const stopPropagation = (event) => event.stopPropagation();
151
- return /* @__PURE__ */ jsxs("div", {
152
- className: [
153
- "pd-design__frame",
154
- showFrame && "pd-design__frame--visible",
155
- className
156
- ].filter(Boolean).join(" "),
157
- ref: nodeRef,
158
- children: [
159
- showFrame && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", { className: "pd-design__frame--x" }), /* @__PURE__ */ jsx("div", { className: "pd-design__frame--y" })] }),
160
- /* @__PURE__ */ jsxs("div", {
161
- className: "pd-design__frame__label",
162
- onMouseDown: stopPropagation,
163
- children: [
164
- componentType?.image && /* @__PURE__ */ jsx("span", {
165
- className: "pd-design__icon",
166
- children: /* @__PURE__ */ jsx("img", {
167
- src: componentType.image,
168
- alt: ""
169
- })
170
- }),
171
- /* @__PURE__ */ jsx("span", {
172
- className: "pd-design__frame__name",
173
- children: name
174
- }),
175
- !localized && /* @__PURE__ */ jsx("span", {
176
- className: "pd-design__frame__fallback-badge",
177
- children: labels.fallback ?? "Fallback"
178
- })
179
- ]
180
- }),
181
- showToolbox && /* @__PURE__ */ jsxs("div", {
182
- className: "pd-design__frame__toolbox",
183
- children: [isMoveable && /* @__PURE__ */ jsx(MoveToolboxButton, { title: labels.moveComponent ?? "Move component" }), /* @__PURE__ */ jsx(DeleteToolboxButton, {
184
- title: labels.deleteComponent ?? "Delete component",
185
- onMouseDown: stopPropagation,
186
- onClick: handleDelete
187
- })]
188
- }),
189
- /* @__PURE__ */ jsx(DesignOverlay, {}),
190
- children
191
- ]
192
- });
193
- };
194
- DesignFrame.defaultProps = {
195
- parentId: void 0,
196
- componentId: void 0,
197
- showToolbox: true,
198
- regionId: void 0,
199
- showFrame: false
200
- };
201
-
202
- //#endregion
203
- export { useNodeToTargetStore as i, useLabels as n, useComponentType as r, DesignFrame as t };
204
- //# sourceMappingURL=DesignFrame.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DesignFrame.js","names":[],"sources":["../src/design/react/hooks/useNodeToTargetStore.ts","../src/design/react/hooks/useComponentType.ts","../src/design/react/components/DeleteToolboxButton.tsx","../src/design/react/components/MoveToolboxButton.tsx","../src/design/react/hooks/useLabels.ts","../src/design/react/components/DesignOverlay.tsx","../src/design/react/components/DesignFrame.tsx"],"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 */\nimport React from 'react';\nimport { useDesignState } from './useDesignState';\nimport type { NodeToTargetMapEntry } from '../context/DesignStateContext';\n\nexport function useNodeToTargetStore({\n parentId,\n componentId,\n contentLinkUuid,\n regionId,\n nodeRef,\n type,\n contentLinkUuids,\n componentTypeInclusions,\n componentTypeExclusions,\n}: Partial<NodeToTargetMapEntry> & {\n nodeRef: React.RefObject<Element | null>;\n}): void {\n const { nodeToTargetMap } = useDesignState();\n\n React.useEffect(() => {\n if (nodeRef.current) {\n nodeToTargetMap.set(nodeRef.current, {\n parentId,\n componentId,\n contentLinkUuid,\n regionId,\n type,\n contentLinkUuids,\n componentTypeInclusions,\n componentTypeExclusions,\n } as NodeToTargetMapEntry);\n }\n }, [\n nodeRef,\n parentId,\n componentId,\n contentLinkUuid,\n regionId,\n type,\n contentLinkUuids,\n nodeToTargetMap,\n componentTypeInclusions,\n componentTypeExclusions,\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 { useDesignContext } from '../context/DesignContext';\nimport type { ComponentType } from '../../messaging-api/domain-types';\n\nexport function useComponentType(componentId: string): ComponentType | null {\n const { pageDesignerConfig } = useDesignContext();\n const { type = '' } = pageDesignerConfig?.components[componentId] ?? {};\n\n return pageDesignerConfig?.componentTypes[type] ?? null;\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 React from 'react';\n\nexport const DeleteToolboxButton = ({\n title,\n onClick,\n onMouseDown = () => {\n /* noop */\n },\n}: {\n title: string;\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n}): React.JSX.Element => (\n <button\n className=\"pd-design__frame__toolbox-button\"\n title={title}\n type=\"button\"\n onMouseDown={onMouseDown}\n onClick={onClick}>\n <svg\n className=\"pd-design__frame__delete-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M18 6L6 18M6 6l12 12\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\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 React from 'react';\n\nexport const MoveToolboxButton = ({ title }: { title: string }): React.JSX.Element => (\n <button className=\"pd-design__frame__toolbox-button\" title={title} type=\"button\">\n <svg className=\"pd-design__frame__move-icon\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M22.9 11.7l-3.8-4.2c-.3-.3-.6 0-.6.4v2.7h-4.7c-.2 0-.4-.2-.4-.4V5.5h2.7c.5 0 .7-.4.4-.6l-4.1-3.8c-.2-.2-.5-.2-.7 0L7.6 4.9c-.3.3-.1.6.4.6h2.6v4.7c0 .2-.2.4-.4.4H5.5V7.9c0-.5-.4-.7-.6-.4l-3.8 4.1c-.2.2-.2.5 0 .7l3.8 4.1c.3.3.6.1.6-.4v-2.6h4.7c.2 0 .4.2.4.4v4.7H7.9c-.5 0-.7.4-.4.6l4.1 3.8c.2.2.5.2.7 0l4.1-3.8c.3-.3.1-.6-.4-.6h-2.6v-4.7c0-.2.2-.4.4-.4h4.7v2.7c0 .5.4.7.6.4l3.8-4.1c.2-.3.2-.5 0-.7z\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\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 { useDesignContext } from '../context/DesignContext';\n\nexport function useLabels(): Record<string, string> {\n const { pageDesignerConfig } = useDesignContext();\n\n return pageDesignerConfig?.labels ?? {};\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 */\nexport const DesignOverlay = () => {\n return (\n <div className=\"pd-design__frame__overlay\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n x=\"0px\"\n y=\"0px\"\n width=\"52px\"\n height=\"52px\"\n viewBox=\"0 0 52 52\"\n enableBackground=\"new 0 0 52 52\"\n xmlSpace=\"preserve\">\n <path\n fill=\"#FFFFFF\"\n d=\"M26,2C12.7,2,2,12.7,2,26s10.7,24,24,24s24-10.7,24-24S39.3,2,26,2z M26,7C26,7,26,7,26,7C26,7,26,7,26,7\n\tC26,7,26,7,26,7z M28,7.1c-0.1,0-0.1,0-0.2,0C27.9,7.1,28,7.1,28,7.1z M26,45C15.5,45,7,36.5,7,26c0-1,0.1-2.1,0.3-3\n\tc1.3,0.2,2.9,0.7,3.7,1.5c1.7,1.8,3.6,3.9,5.4,4.3c0,0-0.2,0.1-0.4,0.4c-0.2,0.3-0.4,0.9-0.4,1.9c0,4.7,4.4,1.9,4.4,6.6\n\tc0,4.7,5.3,6.6,5.3,2.8s3.5-5.6,3.5-8.5s-2.7-2.8-4.4-3.8c-1.8-0.9-2.7-2.4-6.1-1.9c-1.8-1.7-2.8-3.1-2-4.7c0.9-1.7,4.6-2,4.6-4.6\n\ts-2.5-3.1-4.3-3.1c-0.8,0-2.5-0.6-3.9-1.3c1.7-1.7,3.8-3.1,6-4.1c1.6,0.7,4.3,1.8,6.6,1.8c2.7,0,4.1-1.9,3.7-3.1\n\tc4.5,0.7,8.5,3,11.4,6.2c-1.5,0.9-3.5,1.9-7,1.9c-4.6,0-4.6,4.7-1.9,5.6c2.8,0.9,5.6-1.8,6.5,0c0.9,1.8-6.5,1.8-4.6,6.4\n\tc1.9,4.6,3.7-0.1,5.6,4.5c1.9,4.6,5.6-0.7,2.8-4.3c-1.2-1.6-0.9-6.5,1.9-6.5h0.9c0.4,1.6,0.7,3.3,0.7,5C45,36.5,36.5,45,26,45z\"\n />\n </svg>\n </div>\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 React from 'react';\nimport { useComponentType } from '../hooks/useComponentType';\nimport { DeleteToolboxButton } from './DeleteToolboxButton';\nimport { MoveToolboxButton } from './MoveToolboxButton';\nimport { useDesignState } from '../hooks/useDesignState';\nimport { useLabels } from '../hooks/useLabels';\nimport { DesignOverlay } from './DesignOverlay';\n\nexport const DesignFrame = ({\n componentId,\n children,\n name,\n parentId,\n regionId,\n contentLinkUuid,\n localized = false,\n showFrame = false,\n showToolbox = true,\n isMoveable = true,\n className,\n}: React.PropsWithChildren<{\n componentId?: string;\n name: string;\n localized?: boolean;\n parentId?: string;\n regionId?: string;\n contentLinkUuid?: string;\n showToolbox?: boolean;\n showFrame?: boolean;\n isMoveable?: boolean;\n className?: string;\n}>): React.JSX.Element => {\n const componentType = useComponentType(componentId ?? '');\n const { deleteComponent } = useDesignState();\n const labels = useLabels();\n const nodeRef = React.useRef<HTMLDivElement>(null);\n\n const handleDelete = React.useCallback(\n (event: React.MouseEvent) => {\n // Stop propagation so we don't select the component as well when\n // this bubbles up.\n event.stopPropagation();\n\n if (componentId) {\n deleteComponent({\n componentId,\n contentLinkUuid: contentLinkUuid ?? '',\n sourceComponentId: parentId ?? '',\n sourceRegionId: regionId ?? '',\n });\n }\n },\n [deleteComponent, componentId, contentLinkUuid, parentId, regionId]\n );\n\n const stopPropagation = (event: React.MouseEvent) => event.stopPropagation();\n\n const classes = ['pd-design__frame', showFrame && 'pd-design__frame--visible', className].filter(Boolean).join(' ');\n\n // TODO: For the frame label, when there is not enough space above the component to display it, we\n // need to display it inside the container instead.\n return (\n <div className={classes} ref={nodeRef}>\n {showFrame && (\n <>\n <div className=\"pd-design__frame--x\" />\n <div className=\"pd-design__frame--y\" />\n </>\n )}\n <div className=\"pd-design__frame__label\" onMouseDown={stopPropagation}>\n {componentType?.image && (\n <span className=\"pd-design__icon\">\n <img src={componentType.image} alt=\"\" />\n </span>\n )}\n <span className=\"pd-design__frame__name\">{name}</span>\n {!localized && (\n <span className=\"pd-design__frame__fallback-badge\">{labels.fallback ?? 'Fallback'}</span>\n )}\n </div>\n {showToolbox && (\n <div className=\"pd-design__frame__toolbox\">\n {isMoveable && <MoveToolboxButton title={labels.moveComponent ?? 'Move component'} />}\n <DeleteToolboxButton\n title={labels.deleteComponent ?? 'Delete component'}\n onMouseDown={stopPropagation}\n onClick={handleDelete}\n />\n </div>\n )}\n <DesignOverlay />\n {children}\n </div>\n );\n};\n\nDesignFrame.defaultProps = {\n parentId: undefined,\n componentId: undefined,\n showToolbox: true,\n regionId: undefined,\n showFrame: false,\n};\n"],"mappings":";;;;;AAmBA,SAAgB,qBAAqB,EACjC,UACA,aACA,iBACA,UACA,SACA,MACA,kBACA,yBACA,2BAGK;CACL,MAAM,EAAE,oBAAoB,gBAAgB;AAE5C,OAAM,gBAAgB;AAClB,MAAI,QAAQ,QACR,iBAAgB,IAAI,QAAQ,SAAS;GACjC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACH,CAAyB;IAE/B;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACH,CAAC;;;;;ACxCN,SAAgB,iBAAiB,aAA2C;CACxE,MAAM,EAAE,uBAAuB,kBAAkB;CACjD,MAAM,EAAE,OAAO,OAAO,oBAAoB,WAAW,gBAAgB,EAAE;AAEvE,QAAO,oBAAoB,eAAe,SAAS;;;;;ACLvD,MAAa,uBAAuB,EAChC,OACA,SACA,oBAAoB,SAQpB,oBAAC;CACG,WAAU;CACH;CACP,MAAK;CACQ;CACJ;WACT,oBAAC;EACG,WAAU;EACV,SAAQ;EACR,MAAK;EACL,OAAM;YACN,oBAAC;GACG,GAAE;GACF,QAAO;GACP,aAAY;GACZ,eAAc;GACd,gBAAe;IACjB;GACA;EACD;;;;AC9Bb,MAAa,qBAAqB,EAAE,YAChC,oBAAC;CAAO,WAAU;CAA0C;CAAO,MAAK;WACpE,oBAAC;EAAI,WAAU;EAA8B,SAAQ;EAAY,OAAM;YACnE,oBAAC;GACG,GAAE;GACF,QAAO;GACP,aAAY;GACZ,eAAc;GACd,gBAAe;IACjB;GACA;EACD;;;;ACXb,SAAgB,YAAoC;CAChD,MAAM,EAAE,uBAAuB,kBAAkB;AAEjD,QAAO,oBAAoB,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;ACL3C,MAAa,sBAAsB;AAC/B,QACI,oBAAC;EAAI,WAAU;YACX,oBAAC;GACG,OAAM;GACN,GAAE;GACF,GAAE;GACF,OAAM;GACN,QAAO;GACP,SAAQ;GACR,kBAAiB;GACjB,UAAS;aACT,oBAAC;IACG,MAAK;IACL,GAAE;KAOJ;IACA;GACJ;;;;;ACfd,MAAa,eAAe,EACxB,aACA,UACA,MACA,UACA,UACA,iBACA,YAAY,OACZ,YAAY,OACZ,cAAc,MACd,aAAa,MACb,gBAYsB;CACtB,MAAM,gBAAgB,iBAAiB,eAAe,GAAG;CACzD,MAAM,EAAE,oBAAoB,gBAAgB;CAC5C,MAAM,SAAS,WAAW;CAC1B,MAAM,UAAU,MAAM,OAAuB,KAAK;CAElD,MAAM,eAAe,MAAM,aACtB,UAA4B;AAGzB,QAAM,iBAAiB;AAEvB,MAAI,YACA,iBAAgB;GACZ;GACA,iBAAiB,mBAAmB;GACpC,mBAAmB,YAAY;GAC/B,gBAAgB,YAAY;GAC/B,CAAC;IAGV;EAAC;EAAiB;EAAa;EAAiB;EAAU;EAAS,CACtE;CAED,MAAM,mBAAmB,UAA4B,MAAM,iBAAiB;AAM5E,QACI,qBAAC;EAAI,WALO;GAAC;GAAoB,aAAa;GAA6B;GAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;EAKtF,KAAK;;GACzB,aACG,4CACI,oBAAC,SAAI,WAAU,wBAAwB,EACvC,oBAAC,SAAI,WAAU,wBAAwB,IACxC;GAEP,qBAAC;IAAI,WAAU;IAA0B,aAAa;;KACjD,eAAe,SACZ,oBAAC;MAAK,WAAU;gBACZ,oBAAC;OAAI,KAAK,cAAc;OAAO,KAAI;QAAK;OACrC;KAEX,oBAAC;MAAK,WAAU;gBAA0B;OAAY;KACrD,CAAC,aACE,oBAAC;MAAK,WAAU;gBAAoC,OAAO,YAAY;OAAkB;;KAE3F;GACL,eACG,qBAAC;IAAI,WAAU;eACV,cAAc,oBAAC,qBAAkB,OAAO,OAAO,iBAAiB,mBAAoB,EACrF,oBAAC;KACG,OAAO,OAAO,mBAAmB;KACjC,aAAa;KACb,SAAS;MACX;KACA;GAEV,oBAAC,kBAAgB;GAChB;;GACC;;AAId,YAAY,eAAe;CACvB,UAAU;CACV,aAAa;CACb,aAAa;CACb,UAAU;CACV,WAAW;CACd"}
@@ -1,20 +0,0 @@
1
- import * as react_router0 from "react-router";
2
- import { RouterContextProvider } from "react-router";
3
-
4
- //#region src/data-store/middleware/custom-global-preferences.d.ts
5
-
6
- type CustomGlobalPreferences = Record<string, unknown>;
7
- declare const DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY = "custom-global-preferences";
8
- declare const customGlobalPreferencesContext: react_router0.RouterContext<CustomGlobalPreferences | null>;
9
- /**
10
- * Read custom global preferences from router context.
11
- *
12
- * @param context - Router context provider
13
- * @returns Custom global preferences data stored by data-store middleware
14
- * @throws Error when the data-store context is not available
15
- */
16
- declare function getCustomGlobalPreferences(context: Readonly<RouterContextProvider>): CustomGlobalPreferences;
17
- declare const customGlobalPreferencesMiddleware: react_router0.MiddlewareFunction<Response>;
18
- //#endregion
19
- export { getCustomGlobalPreferences as a, customGlobalPreferencesMiddleware as i, DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY as n, customGlobalPreferencesContext as r, CustomGlobalPreferences as t };
20
- //# sourceMappingURL=custom-global-preferences.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-global-preferences.d.ts","names":[],"sources":["../src/data-store/middleware/custom-global-preferences.ts"],"sourcesContent":[],"mappings":";;;;;KAmBY,uBAAA,GAA0B;cAEzB,qCAAA;cACA,gCAA8B,aAAA,CAAA,cAAA;;;;;;;;iBAU3B,0BAAA,UAAoC,SAAS,yBAAyB;cAYzE,mCAAiC,aAAA,CAAA,mBAAA"}
@@ -1,31 +0,0 @@
1
- import { n as createDataStoreMiddleware, t as createDataStoreContext } from "./utils.js";
2
-
3
- //#region src/data-store/middleware/custom-global-preferences.ts
4
- const DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY = "custom-global-preferences";
5
- const customGlobalPreferencesContext = createDataStoreContext();
6
- const DATA_STORE_UNAVAILABLE_MODE = process.env.SFNEXT_DATA_STORE_UNAVAILABLE_MODE;
7
- /**
8
- * Read custom global preferences from router context.
9
- *
10
- * @param context - Router context provider
11
- * @returns Custom global preferences data stored by data-store middleware
12
- * @throws Error when the data-store context is not available
13
- */
14
- function getCustomGlobalPreferences(context) {
15
- const data = context.get(customGlobalPreferencesContext);
16
- if (!data) {
17
- console.warn("Custom global preferences context not found. Ensure data-store middleware runs before loaders and the required env vars are set.");
18
- return {};
19
- }
20
- return data;
21
- }
22
- const customGlobalPreferencesMiddleware = createDataStoreMiddleware({
23
- entryKey: DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY,
24
- context: customGlobalPreferencesContext,
25
- onUnavailable: DATA_STORE_UNAVAILABLE_MODE === "fallback" ? "fallback" : "throw",
26
- fallbackValue: {}
27
- });
28
-
29
- //#endregion
30
- export { getCustomGlobalPreferences as i, customGlobalPreferencesContext as n, customGlobalPreferencesMiddleware as r, DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY as t };
31
- //# sourceMappingURL=custom-global-preferences.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-global-preferences.js","names":[],"sources":["../src/data-store/middleware/custom-global-preferences.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\nimport type { RouterContextProvider } from 'react-router';\nimport { createDataStoreContext, createDataStoreMiddleware } from '../utils';\n\nexport type CustomGlobalPreferences = Record<string, unknown>;\n\nexport const DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY = 'custom-global-preferences';\nexport const customGlobalPreferencesContext = createDataStoreContext<CustomGlobalPreferences>();\nconst DATA_STORE_UNAVAILABLE_MODE = process.env.SFNEXT_DATA_STORE_UNAVAILABLE_MODE;\n\n/**\n * Read custom global preferences from router context.\n *\n * @param context - Router context provider\n * @returns Custom global preferences data stored by data-store middleware\n * @throws Error when the data-store context is not available\n */\nexport function getCustomGlobalPreferences(context: Readonly<RouterContextProvider>): CustomGlobalPreferences {\n const data = context.get(customGlobalPreferencesContext);\n if (!data) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Custom global preferences context not found. Ensure data-store middleware runs before loaders and the required env vars are set.'\n );\n return {};\n }\n return data;\n}\n\nexport const customGlobalPreferencesMiddleware = createDataStoreMiddleware({\n entryKey: DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY,\n context: customGlobalPreferencesContext,\n onUnavailable: DATA_STORE_UNAVAILABLE_MODE === 'fallback' ? 'fallback' : 'throw',\n fallbackValue: {},\n});\n"],"mappings":";;;AAqBA,MAAa,wCAAwC;AACrD,MAAa,iCAAiC,wBAAiD;AAC/F,MAAM,8BAA8B,QAAQ,IAAI;;;;;;;;AAShD,SAAgB,2BAA2B,SAAmE;CAC1G,MAAM,OAAO,QAAQ,IAAI,+BAA+B;AACxD,KAAI,CAAC,MAAM;AAEP,UAAQ,KACJ,mIACH;AACD,SAAO,EAAE;;AAEb,QAAO;;AAGX,MAAa,oCAAoC,0BAA0B;CACvE,UAAU;CACV,SAAS;CACT,eAAe,gCAAgC,aAAa,aAAa;CACzE,eAAe,EAAE;CACpB,CAAC"}
@@ -1,20 +0,0 @@
1
- import * as react_router3 from "react-router";
2
- import { RouterContextProvider } from "react-router";
3
-
4
- //#region src/data-store/middleware/custom-site-preferences.d.ts
5
-
6
- type SitePreferences = Record<string, unknown>;
7
- declare const DEFAULT_SITE_PREFERENCES_KEY = "site-preferences";
8
- declare const sitePreferencesContext: react_router3.RouterContext<SitePreferences | null>;
9
- /**
10
- * Read site preferences from router context.
11
- *
12
- * @param context - Router context provider
13
- * @returns Site preferences data stored by data-store middleware
14
- * @throws Error when the data-store context is not available
15
- */
16
- declare function getSitePreferences(context: Readonly<RouterContextProvider>): SitePreferences;
17
- declare const customSitePreferencesMiddleware: react_router3.MiddlewareFunction<Response>;
18
- //#endregion
19
- export { sitePreferencesContext as a, getSitePreferences as i, SitePreferences as n, customSitePreferencesMiddleware as r, DEFAULT_SITE_PREFERENCES_KEY as t };
20
- //# sourceMappingURL=custom-site-preferences.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-site-preferences.d.ts","names":[],"sources":["../src/data-store/middleware/custom-site-preferences.ts"],"sourcesContent":[],"mappings":";;;;;KAmBY,eAAA,GAAkB;cAEjB,4BAAA;cACA,wBAAsB,aAAA,CAAA,cAAA;;;;;;;;iBAUnB,kBAAA,UAA4B,SAAS,yBAAyB;cAYjE,iCAA+B,aAAA,CAAA,mBAAA"}
@@ -1,31 +0,0 @@
1
- import { i as prefixWithSiteId, n as createDataStoreMiddleware, t as createDataStoreContext } from "./utils.js";
2
-
3
- //#region src/data-store/middleware/custom-site-preferences.ts
4
- const DEFAULT_SITE_PREFERENCES_KEY = "site-preferences";
5
- const sitePreferencesContext = createDataStoreContext();
6
- const DATA_STORE_UNAVAILABLE_MODE = process.env.SFNEXT_DATA_STORE_UNAVAILABLE_MODE;
7
- /**
8
- * Read site preferences from router context.
9
- *
10
- * @param context - Router context provider
11
- * @returns Site preferences data stored by data-store middleware
12
- * @throws Error when the data-store context is not available
13
- */
14
- function getSitePreferences(context) {
15
- const data = context.get(sitePreferencesContext);
16
- if (!data) {
17
- console.warn("Data store context not found. Ensure data-store middleware runs before loaders and the required env vars are set.");
18
- return {};
19
- }
20
- return data;
21
- }
22
- const customSitePreferencesMiddleware = createDataStoreMiddleware({
23
- entryKey: prefixWithSiteId("custom-site-preferences"),
24
- context: sitePreferencesContext,
25
- onUnavailable: DATA_STORE_UNAVAILABLE_MODE === "fallback" ? "fallback" : "throw",
26
- fallbackValue: {}
27
- });
28
-
29
- //#endregion
30
- export { sitePreferencesContext as i, customSitePreferencesMiddleware as n, getSitePreferences as r, DEFAULT_SITE_PREFERENCES_KEY as t };
31
- //# sourceMappingURL=custom-site-preferences.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-site-preferences.js","names":[],"sources":["../src/data-store/middleware/custom-site-preferences.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\nimport type { RouterContextProvider } from 'react-router';\nimport { createDataStoreContext, createDataStoreMiddleware, prefixWithSiteId } from '../utils';\n\nexport type SitePreferences = Record<string, unknown>;\n\nexport const DEFAULT_SITE_PREFERENCES_KEY = 'site-preferences';\nexport const sitePreferencesContext = createDataStoreContext<SitePreferences>();\nconst DATA_STORE_UNAVAILABLE_MODE = process.env.SFNEXT_DATA_STORE_UNAVAILABLE_MODE;\n\n/**\n * Read site preferences from router context.\n *\n * @param context - Router context provider\n * @returns Site preferences data stored by data-store middleware\n * @throws Error when the data-store context is not available\n */\nexport function getSitePreferences(context: Readonly<RouterContextProvider>): SitePreferences {\n const data = context.get(sitePreferencesContext);\n if (!data) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Data store context not found. Ensure data-store middleware runs before loaders and the required env vars are set.'\n );\n return {};\n }\n return data;\n}\n\nexport const customSitePreferencesMiddleware = createDataStoreMiddleware({\n entryKey: prefixWithSiteId('custom-site-preferences'),\n context: sitePreferencesContext,\n onUnavailable: DATA_STORE_UNAVAILABLE_MODE === 'fallback' ? 'fallback' : 'throw',\n fallbackValue: {},\n});\n"],"mappings":";;;AAqBA,MAAa,+BAA+B;AAC5C,MAAa,yBAAyB,wBAAyC;AAC/E,MAAM,8BAA8B,QAAQ,IAAI;;;;;;;;AAShD,SAAgB,mBAAmB,SAA2D;CAC1F,MAAM,OAAO,QAAQ,IAAI,uBAAuB;AAChD,KAAI,CAAC,MAAM;AAEP,UAAQ,KACJ,oHACH;AACD,SAAO,EAAE;;AAEb,QAAO;;AAGX,MAAa,kCAAkC,0BAA0B;CACrE,UAAU,iBAAiB,0BAA0B;CACrD,SAAS;CACT,eAAe,gCAAgC,aAAa,aAAa;CACzE,eAAe,EAAE;CACpB,CAAC"}
@@ -1,2 +0,0 @@
1
- import { a as getCustomGlobalPreferences, i as customGlobalPreferencesMiddleware, n as DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY, r as customGlobalPreferencesContext, t as CustomGlobalPreferences } from "./custom-global-preferences.js";
2
- export { CustomGlobalPreferences, DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY, customGlobalPreferencesContext, customGlobalPreferencesMiddleware, getCustomGlobalPreferences };
@@ -1,6 +0,0 @@
1
- import "./site-context2.js";
2
- import "./apply-url-config.js";
3
- import "./utils.js";
4
- import { i as getCustomGlobalPreferences, n as customGlobalPreferencesContext, r as customGlobalPreferencesMiddleware, t as DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY } from "./custom-global-preferences.js";
5
-
6
- export { DEFAULT_CUSTOM_GLOBAL_PREFERENCES_KEY, customGlobalPreferencesContext, customGlobalPreferencesMiddleware, getCustomGlobalPreferences };
@@ -1,2 +0,0 @@
1
- import { a as sitePreferencesContext, i as getSitePreferences, n as SitePreferences, r as customSitePreferencesMiddleware, t as DEFAULT_SITE_PREFERENCES_KEY } from "./custom-site-preferences.js";
2
- export { DEFAULT_SITE_PREFERENCES_KEY, SitePreferences, customSitePreferencesMiddleware, getSitePreferences, sitePreferencesContext };
@@ -1,6 +0,0 @@
1
- import "./site-context2.js";
2
- import "./apply-url-config.js";
3
- import "./utils.js";
4
- import { i as sitePreferencesContext, n as customSitePreferencesMiddleware, r as getSitePreferences, t as DEFAULT_SITE_PREFERENCES_KEY } from "./custom-site-preferences.js";
5
-
6
- export { DEFAULT_SITE_PREFERENCES_KEY, customSitePreferencesMiddleware, getSitePreferences, sitePreferencesContext };
@@ -1,2 +0,0 @@
1
- import { a as getGcpApiKey, i as gcpPreferencesMiddleware, n as GcpPreferences, o as getGcpPreferences, r as gcpPreferencesContext, t as DEFAULT_GCP_PREFERENCES_KEY } from "./gcp-preferences.js";
2
- export { DEFAULT_GCP_PREFERENCES_KEY, GcpPreferences, gcpPreferencesContext, gcpPreferencesMiddleware, getGcpApiKey, getGcpPreferences };
@@ -1,6 +0,0 @@
1
- import "./site-context2.js";
2
- import "./apply-url-config.js";
3
- import "./utils.js";
4
- import { a as getGcpPreferences, i as getGcpApiKey, n as gcpPreferencesContext, r as gcpPreferencesMiddleware, t as DEFAULT_GCP_PREFERENCES_KEY } from "./gcp-preferences.js";
5
-
6
- export { DEFAULT_GCP_PREFERENCES_KEY, gcpPreferencesContext, gcpPreferencesMiddleware, getGcpApiKey, getGcpPreferences };
@@ -1,52 +0,0 @@
1
- import * as react_router1 from "react-router";
2
- import { RouterContextProvider } from "react-router";
3
-
4
- //#region src/data-store/middleware/gcp-preferences.d.ts
5
-
6
- /**
7
- * OOTB Google Cloud Platform preferences sourced from the MRT data store.
8
- *
9
- * Additional fields (e.g. `projectId`, `region`) may be added here as the
10
- * ECOM MRT sync job expands the `gcp` entry. Consumers should read the
11
- * object as a whole via `getGcpPreferences`, or use a specific convenience
12
- * getter like `getGcpApiKey` for a single field.
13
- */
14
- type GcpPreferences = {
15
- apiKey: string;
16
- };
17
- declare const DEFAULT_GCP_PREFERENCES_KEY = "gcp";
18
- declare const gcpPreferencesContext: react_router1.RouterContext<GcpPreferences | null>;
19
- /**
20
- * Read the GCP (Google Cloud Platform) preferences object from router context.
21
- *
22
- * The preferences are sourced from the MRT data store entry `gcp`, which is
23
- * populated only for storefronts connecting to production ECOM instances.
24
- * In non-production environments, or when the entry is missing, returns an
25
- * object whose fields are all empty/default.
26
- *
27
- * @param context - Router context provider
28
- * @returns GCP preferences object; fields are empty/default when the entry is unavailable
29
- */
30
- declare function getGcpPreferences(context: Readonly<RouterContextProvider>): GcpPreferences;
31
- /**
32
- * Convenience getter for the Google Cloud API key alone.
33
- *
34
- * Equivalent to `getGcpPreferences(context).apiKey`.
35
- *
36
- * @param context - Router context provider
37
- * @returns The GCP API key, or an empty string when unavailable
38
- */
39
- declare function getGcpApiKey(context: Readonly<RouterContextProvider>): string;
40
- /**
41
- * Middleware that reads the OOTB GCP preferences from the MRT data store and
42
- * stores them in the router context. The entry shape is `{ "api-key": string, ... }`
43
- * under data store key `gcp`. Missing/invalid fields coerce to empty/default values.
44
- *
45
- * Only available for storefronts connecting to production ECOM instances.
46
- * Must run before any loader/middleware that reads `getGcpPreferences(context)`
47
- * or `getGcpApiKey(context)`.
48
- */
49
- declare const gcpPreferencesMiddleware: react_router1.MiddlewareFunction<Response>;
50
- //#endregion
51
- export { getGcpApiKey as a, gcpPreferencesMiddleware as i, GcpPreferences as n, getGcpPreferences as o, gcpPreferencesContext as r, DEFAULT_GCP_PREFERENCES_KEY as t };
52
- //# sourceMappingURL=gcp-preferences.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gcp-preferences.d.ts","names":[],"sources":["../src/data-store/middleware/gcp-preferences.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;KA2BY,cAAA;;;cAIC,2BAAA;cASA,uBAAqB,aAAA,CAAA,cAAA;;;;;;;;;;;;iBAalB,iBAAA,UAA2B,SAAS,yBAAyB;;;;;;;;;iBAoB7D,YAAA,UAAsB,SAAS;;;;;;;;;;cAalC,0BAAwB,aAAA,CAAA,mBAAA"}
@@ -1,64 +0,0 @@
1
- import { n as createDataStoreMiddleware, t as createDataStoreContext } from "./utils.js";
2
-
3
- //#region src/data-store/middleware/gcp-preferences.ts
4
- const DEFAULT_GCP_PREFERENCES_KEY = "gcp";
5
- const DATA_STORE_UNAVAILABLE_MODE = process.env.SFNEXT_DATA_STORE_UNAVAILABLE_MODE;
6
- /**
7
- * Map keys inside the `gcp` data store entry. The ECOM MRT sync job writes
8
- * to these exact keys; keep in sync with the sync job contract.
9
- */
10
- const API_KEY_MAP_KEY = "api-key";
11
- const gcpPreferencesContext = createDataStoreContext();
12
- /**
13
- * Read the GCP (Google Cloud Platform) preferences object from router context.
14
- *
15
- * The preferences are sourced from the MRT data store entry `gcp`, which is
16
- * populated only for storefronts connecting to production ECOM instances.
17
- * In non-production environments, or when the entry is missing, returns an
18
- * object whose fields are all empty/default.
19
- *
20
- * @param context - Router context provider
21
- * @returns GCP preferences object; fields are empty/default when the entry is unavailable
22
- */
23
- function getGcpPreferences(context) {
24
- const data = context.get(gcpPreferencesContext);
25
- if (data === null) {
26
- console.warn("GCP preferences context not found. Ensure gcpPreferencesMiddleware runs before loaders, or expect empty values in environments without the MRT data store entry.");
27
- return { apiKey: "" };
28
- }
29
- return data;
30
- }
31
- /**
32
- * Convenience getter for the Google Cloud API key alone.
33
- *
34
- * Equivalent to `getGcpPreferences(context).apiKey`.
35
- *
36
- * @param context - Router context provider
37
- * @returns The GCP API key, or an empty string when unavailable
38
- */
39
- function getGcpApiKey(context) {
40
- return getGcpPreferences(context).apiKey;
41
- }
42
- /**
43
- * Middleware that reads the OOTB GCP preferences from the MRT data store and
44
- * stores them in the router context. The entry shape is `{ "api-key": string, ... }`
45
- * under data store key `gcp`. Missing/invalid fields coerce to empty/default values.
46
- *
47
- * Only available for storefronts connecting to production ECOM instances.
48
- * Must run before any loader/middleware that reads `getGcpPreferences(context)`
49
- * or `getGcpApiKey(context)`.
50
- */
51
- const gcpPreferencesMiddleware = createDataStoreMiddleware({
52
- entryKey: DEFAULT_GCP_PREFERENCES_KEY,
53
- context: gcpPreferencesContext,
54
- onUnavailable: DATA_STORE_UNAVAILABLE_MODE === "fallback" ? "fallback" : "throw",
55
- fallbackValue: { apiKey: "" },
56
- transform: (value) => {
57
- const rawKey = value[API_KEY_MAP_KEY];
58
- return { apiKey: typeof rawKey === "string" ? rawKey : "" };
59
- }
60
- });
61
-
62
- //#endregion
63
- export { getGcpPreferences as a, getGcpApiKey as i, gcpPreferencesContext as n, gcpPreferencesMiddleware as r, DEFAULT_GCP_PREFERENCES_KEY as t };
64
- //# sourceMappingURL=gcp-preferences.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gcp-preferences.js","names":[],"sources":["../src/data-store/middleware/gcp-preferences.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\nimport type { RouterContextProvider } from 'react-router';\nimport { createDataStoreContext, createDataStoreMiddleware } from '../utils';\n\n/**\n * OOTB Google Cloud Platform preferences sourced from the MRT data store.\n *\n * Additional fields (e.g. `projectId`, `region`) may be added here as the\n * ECOM MRT sync job expands the `gcp` entry. Consumers should read the\n * object as a whole via `getGcpPreferences`, or use a specific convenience\n * getter like `getGcpApiKey` for a single field.\n */\nexport type GcpPreferences = {\n apiKey: string;\n};\n\nexport const DEFAULT_GCP_PREFERENCES_KEY = 'gcp';\nconst DATA_STORE_UNAVAILABLE_MODE = process.env.SFNEXT_DATA_STORE_UNAVAILABLE_MODE;\n\n/**\n * Map keys inside the `gcp` data store entry. The ECOM MRT sync job writes\n * to these exact keys; keep in sync with the sync job contract.\n */\nconst API_KEY_MAP_KEY = 'api-key';\n\nexport const gcpPreferencesContext = createDataStoreContext<GcpPreferences>();\n\n/**\n * Read the GCP (Google Cloud Platform) preferences object from router context.\n *\n * The preferences are sourced from the MRT data store entry `gcp`, which is\n * populated only for storefronts connecting to production ECOM instances.\n * In non-production environments, or when the entry is missing, returns an\n * object whose fields are all empty/default.\n *\n * @param context - Router context provider\n * @returns GCP preferences object; fields are empty/default when the entry is unavailable\n */\nexport function getGcpPreferences(context: Readonly<RouterContextProvider>): GcpPreferences {\n const data = context.get(gcpPreferencesContext);\n if (data === null) {\n // eslint-disable-next-line no-console\n console.warn(\n 'GCP preferences context not found. Ensure gcpPreferencesMiddleware runs before loaders, or expect empty values in environments without the MRT data store entry.'\n );\n return { apiKey: '' };\n }\n return data;\n}\n\n/**\n * Convenience getter for the Google Cloud API key alone.\n *\n * Equivalent to `getGcpPreferences(context).apiKey`.\n *\n * @param context - Router context provider\n * @returns The GCP API key, or an empty string when unavailable\n */\nexport function getGcpApiKey(context: Readonly<RouterContextProvider>): string {\n return getGcpPreferences(context).apiKey;\n}\n\n/**\n * Middleware that reads the OOTB GCP preferences from the MRT data store and\n * stores them in the router context. The entry shape is `{ \"api-key\": string, ... }`\n * under data store key `gcp`. Missing/invalid fields coerce to empty/default values.\n *\n * Only available for storefronts connecting to production ECOM instances.\n * Must run before any loader/middleware that reads `getGcpPreferences(context)`\n * or `getGcpApiKey(context)`.\n */\nexport const gcpPreferencesMiddleware = createDataStoreMiddleware<GcpPreferences>({\n entryKey: DEFAULT_GCP_PREFERENCES_KEY,\n context: gcpPreferencesContext,\n onUnavailable: DATA_STORE_UNAVAILABLE_MODE === 'fallback' ? 'fallback' : 'throw',\n fallbackValue: { apiKey: '' },\n transform: (value) => {\n const rawKey = value[API_KEY_MAP_KEY];\n return { apiKey: typeof rawKey === 'string' ? rawKey : '' };\n },\n});\n"],"mappings":";;;AA+BA,MAAa,8BAA8B;AAC3C,MAAM,8BAA8B,QAAQ,IAAI;;;;;AAMhD,MAAM,kBAAkB;AAExB,MAAa,wBAAwB,wBAAwC;;;;;;;;;;;;AAa7E,SAAgB,kBAAkB,SAA0D;CACxF,MAAM,OAAO,QAAQ,IAAI,sBAAsB;AAC/C,KAAI,SAAS,MAAM;AAEf,UAAQ,KACJ,mKACH;AACD,SAAO,EAAE,QAAQ,IAAI;;AAEzB,QAAO;;;;;;;;;;AAWX,SAAgB,aAAa,SAAkD;AAC3E,QAAO,kBAAkB,QAAQ,CAAC;;;;;;;;;;;AAYtC,MAAa,2BAA2B,0BAA0C;CAC9E,UAAU;CACV,SAAS;CACT,eAAe,gCAAgC,aAAa,aAAa;CACzE,eAAe,EAAE,QAAQ,IAAI;CAC7B,YAAY,UAAU;EAClB,MAAM,SAAS,MAAM;AACrB,SAAO,EAAE,QAAQ,OAAO,WAAW,WAAW,SAAS,IAAI;;CAElE,CAAC"}
package/dist/utils.js DELETED
@@ -1,90 +0,0 @@
1
- import { i as siteContext } from "./site-context2.js";
2
- import { createContext } from "react-router";
3
- import { DataStore, DataStoreNotFoundError, DataStoreServiceError, DataStoreUnavailableError } from "@salesforce/mrt-utilities/data-store";
4
-
5
- //#region src/data-store/utils.ts
6
- /**
7
- * Creates a typed React Router context for data store entries.
8
- *
9
- * Initializes the context with `null` so middleware can populate it during requests.
10
- *
11
- * @returns React Router context key for data store values
12
- */
13
- function createDataStoreContext() {
14
- return createContext(null);
15
- }
16
- /**
17
- * Creates a data-store middleware that fetches site preferences from MRT data access layer
18
- * and stores them in the router context.
19
- *
20
- * Environment variables:
21
- * - `AWS_REGION` (required): AWS region for the data store table (e.g., "us-east-1")
22
- * - `MOBIFY_PROPERTY_ID` (required): MRT property identifier (e.g., "abcd1234")
23
- * - `DEPLOY_TARGET` (required): MRT deploy target (e.g., "production")
24
- *
25
- * @param options - Middleware options for data store entry and context
26
- * @returns React Router middleware for server requests
27
- */
28
- function createDataStoreMiddleware(options) {
29
- const { entryKey, context: contextKey, onUnavailable = "throw", fallbackValue } = options;
30
- const transform = options.transform ?? ((value) => value);
31
- const dataStoreMiddleware = async ({ context }, next) => {
32
- const resolvedEntryKey = typeof entryKey === "function" ? entryKey(context) : entryKey;
33
- try {
34
- const entry = await getDataStoreEntry(resolvedEntryKey);
35
- if (!entry?.value || typeof entry.value !== "object") {
36
- console.warn(`Data store entry '${resolvedEntryKey}' not found or invalid.`);
37
- return next();
38
- }
39
- context.set(contextKey, transform(entry.value));
40
- } catch (error) {
41
- if (error instanceof DataStoreUnavailableError) {
42
- if (onUnavailable === "fallback" && typeof fallbackValue !== "undefined") {
43
- const resolvedFallbackValue = typeof fallbackValue === "function" ? fallbackValue(context) : fallbackValue;
44
- context.set(contextKey, resolvedFallbackValue);
45
- console.warn(`Data store unavailable for '${resolvedEntryKey}'. Using configured fallback value.`);
46
- return next();
47
- }
48
- throw new Error("Data store is unavailable. Ensure AWS_REGION, MOBIFY_PROPERTY_ID, and DEPLOY_TARGET are set.");
49
- }
50
- if (error instanceof DataStoreNotFoundError) {
51
- console.warn(`Data store entry '${resolvedEntryKey}' not found.`);
52
- return next();
53
- }
54
- if (error instanceof DataStoreServiceError) throw new Error(`Data store request failed for '${resolvedEntryKey}'.`);
55
- throw error;
56
- }
57
- return next();
58
- };
59
- return dataStoreMiddleware;
60
- }
61
- /**
62
- * Read a data-store entry through the singleton MRT utilities API.
63
- * The underlying implementation (production DynamoDB vs development pseudo store)
64
- * is resolved by `@salesforce/mrt-utilities/data-store` export conditions.
65
- *
66
- * @param key - Data-store entry key
67
- * @returns Data-store entry or null when missing/invalid shape
68
- */
69
- async function getDataStoreEntry(key) {
70
- const entry = await DataStore.getDataStore().getEntry(key);
71
- if (!entry || typeof entry !== "object") return null;
72
- return entry;
73
- }
74
- /**
75
- * Creates an entryKey function that prefixes the given suffix with the current site ID.
76
- *
77
- * @param suffix - The entry key suffix (e.g., "custom-site-preferences")
78
- * @returns A function compatible with `DataStoreMiddlewareOptions.entryKey`
79
- */
80
- function prefixWithSiteId(suffix) {
81
- return (context) => {
82
- const siteId = context.get(siteContext)?.site?.id;
83
- if (!siteId) throw new Error("Site id not found. Ensure site context middleware runs before data-store middleware.");
84
- return `${siteId}-${suffix}`;
85
- };
86
- }
87
-
88
- //#endregion
89
- export { prefixWithSiteId as i, createDataStoreMiddleware as n, getDataStoreEntry as r, createDataStoreContext as t };
90
- //# sourceMappingURL=utils.js.map