personalize-connect-sdk 1.3.4 → 1.4.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.
- package/README.md +4 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -8
- package/dist/index.mjs +16 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Personalize Connect SDK
|
|
2
2
|
|
|
3
|
-
Runtime SDK for [Personalize Connect](https://github.com/Sitecore-Hackathon/2026-Team-Solo) — a zero-code bridge between
|
|
3
|
+
Runtime SDK for [Personalize Connect](https://github.com/Sitecore-Hackathon/2026-Team-Solo) — a zero-code bridge between SitecoreAI components and Sitecore Personalize Full Stack Interactive Experiences.
|
|
4
4
|
|
|
5
5
|
The SDK reads configuration authored by the Marketplace app (stored in the content tree), calls Personalize for a decision via the Edge proxy, resolves the matching datasource from Experience Edge, and swaps component content — with zero per-component code. In Page Builder, components with personalization get a visual indicator.
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ npm install personalize-connect-sdk
|
|
|
12
12
|
|
|
13
13
|
Peer dependency: `react` >= 18.
|
|
14
14
|
|
|
15
|
-
## Quick Start (
|
|
15
|
+
## Quick Start (SitecoreAI)
|
|
16
16
|
|
|
17
17
|
### 1. Wrap your app with `PersonalizeProvider`
|
|
18
18
|
|
|
@@ -81,12 +81,12 @@ function MyComponent({ rendering }) {
|
|
|
81
81
|
|
|
82
82
|
## Provider Props
|
|
83
83
|
|
|
84
|
-
###
|
|
84
|
+
### SitecoreAI (recommended)
|
|
85
85
|
|
|
86
86
|
| Prop | Required | Description |
|
|
87
87
|
|------|----------|-------------|
|
|
88
88
|
| `sitecoreEdgeContextId` | Yes | Edge Context ID — drives all Edge proxy calls |
|
|
89
|
-
| `siteName` | Yes |
|
|
89
|
+
| `siteName` | Yes | SitecoreAI site name |
|
|
90
90
|
| `sitecoreEdgeUrl` | No | Edge platform URL (defaults to `https://edge-platform.sitecorecloud.io`) |
|
|
91
91
|
|
|
92
92
|
### Legacy (direct credentials)
|
package/dist/index.d.mts
CHANGED
|
@@ -145,9 +145,9 @@ type GetConfigFromProps<P> = (props: P) => PersonalizeConnectConfig | undefined;
|
|
|
145
145
|
* 1. props.rendering.personalizeConnect (inline on layout data)
|
|
146
146
|
* 2. context.configs map (loaded from content tree via Edge)
|
|
147
147
|
*
|
|
148
|
-
* Live site:
|
|
149
|
-
* Page Builder: shows a preview bar
|
|
150
|
-
* content variants
|
|
148
|
+
* Live site: calls Personalize, resolves winning variant, swaps fields.
|
|
149
|
+
* Page Builder: shows a preview bar BELOW the component to switch between
|
|
150
|
+
* content variants. "Original" keeps fields fully editable.
|
|
151
151
|
*/
|
|
152
152
|
declare function withPersonalizeConnect<P extends object>(WrappedComponent: ComponentType<P>, getConfig?: GetConfigFromProps<P>): ComponentType<P>;
|
|
153
153
|
|
package/dist/index.d.ts
CHANGED
|
@@ -145,9 +145,9 @@ type GetConfigFromProps<P> = (props: P) => PersonalizeConnectConfig | undefined;
|
|
|
145
145
|
* 1. props.rendering.personalizeConnect (inline on layout data)
|
|
146
146
|
* 2. context.configs map (loaded from content tree via Edge)
|
|
147
147
|
*
|
|
148
|
-
* Live site:
|
|
149
|
-
* Page Builder: shows a preview bar
|
|
150
|
-
* content variants
|
|
148
|
+
* Live site: calls Personalize, resolves winning variant, swaps fields.
|
|
149
|
+
* Page Builder: shows a preview bar BELOW the component to switch between
|
|
150
|
+
* content variants. "Original" keeps fields fully editable.
|
|
151
151
|
*/
|
|
152
152
|
declare function withPersonalizeConnect<P extends object>(WrappedComponent: ComponentType<P>, getConfig?: GetConfigFromProps<P>): ComponentType<P>;
|
|
153
153
|
|
package/dist/index.js
CHANGED
|
@@ -760,9 +760,10 @@ var BAR_STYLE = {
|
|
|
760
760
|
fontSize: "12px",
|
|
761
761
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
762
762
|
fontWeight: 500,
|
|
763
|
-
borderRadius: "6px 6px
|
|
764
|
-
|
|
765
|
-
|
|
763
|
+
borderRadius: "0 0 6px 6px",
|
|
764
|
+
flexWrap: "wrap",
|
|
765
|
+
position: "relative",
|
|
766
|
+
zIndex: 1
|
|
766
767
|
};
|
|
767
768
|
var LABEL_STYLE = {
|
|
768
769
|
display: "flex",
|
|
@@ -800,6 +801,12 @@ var LOADING_STYLE = {
|
|
|
800
801
|
fontSize: "10px",
|
|
801
802
|
opacity: 0.7
|
|
802
803
|
};
|
|
804
|
+
var PREVIEW_LABEL = {
|
|
805
|
+
marginLeft: "auto",
|
|
806
|
+
fontSize: "10px",
|
|
807
|
+
opacity: 0.6,
|
|
808
|
+
fontStyle: "italic"
|
|
809
|
+
};
|
|
803
810
|
function PreviewBar({
|
|
804
811
|
config,
|
|
805
812
|
activeKey,
|
|
@@ -831,7 +838,8 @@ function PreviewBar({
|
|
|
831
838
|
},
|
|
832
839
|
key
|
|
833
840
|
)),
|
|
834
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: LOADING_STYLE, children: "loading
|
|
841
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: LOADING_STYLE, children: "loading\u2026" }),
|
|
842
|
+
activeKey !== null && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: PREVIEW_LABEL, children: "preview only \u2014 switch to Original to edit" })
|
|
835
843
|
] });
|
|
836
844
|
}
|
|
837
845
|
function withPersonalizeConnect(WrappedComponent, getConfig = DEFAULT_GET_CONFIG) {
|
|
@@ -950,9 +958,10 @@ function withPersonalizeConnect(WrappedComponent, getConfig = DEFAULT_GET_CONFIG
|
|
|
950
958
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WrappedComponent, { ...props });
|
|
951
959
|
}
|
|
952
960
|
if (isEditing) {
|
|
953
|
-
const
|
|
954
|
-
const editingProps =
|
|
961
|
+
const isPreviewing = previewKey !== null && previewFields !== null;
|
|
962
|
+
const editingProps = isPreviewing ? { ...props, fields: previewFields } : props;
|
|
955
963
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react2.Fragment, { children: [
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WrappedComponent, { ...editingProps }),
|
|
956
965
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
957
966
|
PreviewBar,
|
|
958
967
|
{
|
|
@@ -961,8 +970,7 @@ function withPersonalizeConnect(WrappedComponent, getConfig = DEFAULT_GET_CONFIG
|
|
|
961
970
|
isLoading: previewLoading,
|
|
962
971
|
onSelect: handlePreviewSelect
|
|
963
972
|
}
|
|
964
|
-
)
|
|
965
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WrappedComponent, { ...editingProps })
|
|
973
|
+
)
|
|
966
974
|
] });
|
|
967
975
|
}
|
|
968
976
|
const mergedProps = resolvedFields ? { ...props, fields: resolvedFields } : props;
|
package/dist/index.mjs
CHANGED
|
@@ -719,9 +719,10 @@ var BAR_STYLE = {
|
|
|
719
719
|
fontSize: "12px",
|
|
720
720
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
721
721
|
fontWeight: 500,
|
|
722
|
-
borderRadius: "6px 6px
|
|
723
|
-
|
|
724
|
-
|
|
722
|
+
borderRadius: "0 0 6px 6px",
|
|
723
|
+
flexWrap: "wrap",
|
|
724
|
+
position: "relative",
|
|
725
|
+
zIndex: 1
|
|
725
726
|
};
|
|
726
727
|
var LABEL_STYLE = {
|
|
727
728
|
display: "flex",
|
|
@@ -759,6 +760,12 @@ var LOADING_STYLE = {
|
|
|
759
760
|
fontSize: "10px",
|
|
760
761
|
opacity: 0.7
|
|
761
762
|
};
|
|
763
|
+
var PREVIEW_LABEL = {
|
|
764
|
+
marginLeft: "auto",
|
|
765
|
+
fontSize: "10px",
|
|
766
|
+
opacity: 0.6,
|
|
767
|
+
fontStyle: "italic"
|
|
768
|
+
};
|
|
762
769
|
function PreviewBar({
|
|
763
770
|
config,
|
|
764
771
|
activeKey,
|
|
@@ -790,7 +797,8 @@ function PreviewBar({
|
|
|
790
797
|
},
|
|
791
798
|
key
|
|
792
799
|
)),
|
|
793
|
-
isLoading && /* @__PURE__ */ jsx2("span", { style: LOADING_STYLE, children: "loading
|
|
800
|
+
isLoading && /* @__PURE__ */ jsx2("span", { style: LOADING_STYLE, children: "loading\u2026" }),
|
|
801
|
+
activeKey !== null && !isLoading && /* @__PURE__ */ jsx2("span", { style: PREVIEW_LABEL, children: "preview only \u2014 switch to Original to edit" })
|
|
794
802
|
] });
|
|
795
803
|
}
|
|
796
804
|
function withPersonalizeConnect(WrappedComponent, getConfig = DEFAULT_GET_CONFIG) {
|
|
@@ -909,9 +917,10 @@ function withPersonalizeConnect(WrappedComponent, getConfig = DEFAULT_GET_CONFIG
|
|
|
909
917
|
return /* @__PURE__ */ jsx2(WrappedComponent, { ...props });
|
|
910
918
|
}
|
|
911
919
|
if (isEditing) {
|
|
912
|
-
const
|
|
913
|
-
const editingProps =
|
|
920
|
+
const isPreviewing = previewKey !== null && previewFields !== null;
|
|
921
|
+
const editingProps = isPreviewing ? { ...props, fields: previewFields } : props;
|
|
914
922
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
923
|
+
/* @__PURE__ */ jsx2(WrappedComponent, { ...editingProps }),
|
|
915
924
|
/* @__PURE__ */ jsx2(
|
|
916
925
|
PreviewBar,
|
|
917
926
|
{
|
|
@@ -920,8 +929,7 @@ function withPersonalizeConnect(WrappedComponent, getConfig = DEFAULT_GET_CONFIG
|
|
|
920
929
|
isLoading: previewLoading,
|
|
921
930
|
onSelect: handlePreviewSelect
|
|
922
931
|
}
|
|
923
|
-
)
|
|
924
|
-
/* @__PURE__ */ jsx2(WrappedComponent, { ...editingProps })
|
|
932
|
+
)
|
|
925
933
|
] });
|
|
926
934
|
}
|
|
927
935
|
const mergedProps = resolvedFields ? { ...props, fields: resolvedFields } : props;
|
package/package.json
CHANGED