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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Cl5f7YcH.cjs"),t=require("./CzA4yy-l.cjs");exports.PersonalizationWidget=e.PersonalizationWidget;exports.getPersonalizationData=t.getPersonalizationData;
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: i, brand: a, contentType: s = "article", data: o, model: n }) => {
10
- const [t, c] = u(void 0);
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 (o)
15
- c(o);
16
- else if (s && n && i && a) {
17
- const l = P[n], r = (e = g()) == null ? void 0 : e.deviceId;
18
- if (console.log("fetching data", l, r), r) {
19
- const m = await f(i, {
20
- brand: a,
21
- type: s,
22
- useCase: l,
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", m), o && c(m);
25
+ console.log("data", c), c && l(c);
26
26
  }
27
27
  }
28
28
  })();
29
- }, [i, o, s, n, a]), console.log("personalization data", t), /* @__PURE__ */ d.createElement("div", { "data-id": "personalization-widget" }, t == null ? void 0 : t.data.recommendations.map((e) => /* @__PURE__ */ d.createElement(z, { item: e, key: e.id })));
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
@@ -1,4 +1,4 @@
1
- import { PersonalizationWidget as a } from "./BOgMIZfR.js";
1
+ import { PersonalizationWidget as a } from "./DCOsEeXm.js";
2
2
  import { getPersonalizationData as r } from "./BUU6fvy1.js";
3
3
  export {
4
4
  a as PersonalizationWidget,
package/package.json CHANGED
@@ -41,7 +41,7 @@
41
41
  }
42
42
  },
43
43
  "type": "module",
44
- "version": "0.0.2",
44
+ "version": "0.0.3",
45
45
  "scripts": {
46
46
  "build": "tsc --noEmit && vite build",
47
47
  "build:analyze": "vite-bundle-visualizer",
@@ -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;