ha-nitrous-personalization 0.0.2 → 0.0.3
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./CzA4yy-l.cjs"),m=require("./BrLBNZCr.cjs"),i=require("react"),f=require("./DeikC2LX.cjs"),z={"recommended-for-you":"user_personalization",trending:"trending_now",ymal:"similar_items"},P=({apiKey:o,brand:a,contentType:n="article",data:s,model:r})=>{const[t,d]=i.useState(void 0);return i.useEffect(()=>{(async()=>{var e;if(s)d(s);else if(n&&r&&o&&a){const u=z[r],c=(e=m.getNitrousCookie())==null?void 0:e.deviceId;if(console.log("fetching data",u,c),c){const l=await g.getPersonalizationData(o,{brand:a,type:n,useCase:u,userId:c});console.log("data",l),l&&d(l)}}})()},[o,s,n,r,a]),console.log("personalization data",t),i.createElement("div",{"data-id":"personalization-widget"},t==null?void 0:t.data.recommendations.map(e=>i.createElement(f.PersonalizationWidgetItem,{item:e,key:e.id})))};exports.PersonalizationWidget=P;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./CQSYEp3Q.cjs"),t=require("./CzA4yy-l.cjs");exports.PersonalizationWidget=e.PersonalizationWidget;exports.getPersonalizationData=t.getPersonalizationData;
|
|
@@ -6,27 +6,27 @@ const P = {
|
|
|
6
6
|
"recommended-for-you": "user_personalization",
|
|
7
7
|
trending: "trending_now",
|
|
8
8
|
ymal: "similar_items"
|
|
9
|
-
}, E = ({ apiKey:
|
|
10
|
-
const [
|
|
9
|
+
}, E = ({ apiKey: t, brand: i, contentType: a = "article", data: s, model: n }) => {
|
|
10
|
+
const [o, l] = u(void 0);
|
|
11
11
|
return p(() => {
|
|
12
12
|
(async () => {
|
|
13
13
|
var e;
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
else if (
|
|
17
|
-
const
|
|
18
|
-
if (console.log("fetching data",
|
|
19
|
-
const
|
|
20
|
-
brand:
|
|
21
|
-
type:
|
|
22
|
-
useCase:
|
|
14
|
+
if (s)
|
|
15
|
+
l(s);
|
|
16
|
+
else if (a && n && t && i) {
|
|
17
|
+
const m = P[n], r = (e = g()) == null ? void 0 : e.deviceId;
|
|
18
|
+
if (console.log("fetching data", m, r), r) {
|
|
19
|
+
const c = await f(t, {
|
|
20
|
+
brand: i,
|
|
21
|
+
type: a,
|
|
22
|
+
useCase: m,
|
|
23
23
|
userId: r
|
|
24
24
|
});
|
|
25
|
-
console.log("data",
|
|
25
|
+
console.log("data", c), c && l(c);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
})();
|
|
29
|
-
}, [
|
|
29
|
+
}, [t, s, a, n, i]), console.log("personalization data", o), /* @__PURE__ */ d.createElement("div", { "data-id": "personalization-widget" }, o == null ? void 0 : o.data.recommendations.map((e) => /* @__PURE__ */ d.createElement(z, { item: e, key: e.id })));
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
32
|
E as PersonalizationWidget
|
package/dist/esm/index.js
CHANGED
package/package.json
CHANGED
package/dist/cjs/Cl5f7YcH.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./CzA4yy-l.cjs"),m=require("./BrLBNZCr.cjs"),o=require("react"),f=require("./DeikC2LX.cjs"),z={"recommended-for-you":"user_personalization",trending:"trending_now",ymal:"similar_items"},P=({apiKey:a,brand:n,contentType:s="article",data:t,model:r})=>{const[i,l]=o.useState(void 0);return o.useEffect(()=>{(async()=>{var e;if(t)l(t);else if(s&&r&&a&&n){const d=z[r],c=(e=m.getNitrousCookie())==null?void 0:e.deviceId;if(console.log("fetching data",d,c),c){const u=await g.getPersonalizationData(a,{brand:n,type:s,useCase:d,userId:c});console.log("data",u),t&&l(u)}}})()},[a,t,s,r,n]),console.log("personalization data",i),o.createElement("div",{"data-id":"personalization-widget"},i==null?void 0:i.data.recommendations.map(e=>o.createElement(f.PersonalizationWidgetItem,{item:e,key:e.id})))};exports.PersonalizationWidget=P;
|