@disconetwork/shopify 0.0.6 → 0.0.8

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/dist/index.d.ts CHANGED
@@ -37,5 +37,51 @@ declare function DiscoRecommendations({
37
37
  ...source
38
38
  }: DiscoRecommendationsProps): import("preact").JSX.Element;
39
39
  //#endregion
40
- export { DiscoRecommendations, type DiscoRecommendationsProps, type RecommendationsRequest };
40
+ //#region src/prepurchase/DiscoPrepurchaseIncentive.d.ts
41
+ type DiscoPrepurchaseIncentiveProps = {
42
+ /**
43
+ * The merchant's public API key (a PUBLISHER_CHANNEL `disco_pk_live_…` key).
44
+ * Requests go to Disco's production backend, authenticated by the key.
45
+ */
46
+ apiKey: string;
47
+ };
48
+ /**
49
+ * Disco's prepurchase cash-back opt-in, shown in checkout.
50
+ *
51
+ * Render it from a `purchase.checkout.reductions.render-before` or
52
+ * `purchase.checkout.actions.render-before` target. The opt-in is persisted to
53
+ * a checkout attribute that `DiscoPrepurchaseThankYou` reads after purchase, so
54
+ * render that too: it is what submits the order.
55
+ *
56
+ * Renders nothing when there is no incentive for this checkout, including when
57
+ * the key is rejected.
58
+ */
59
+ declare function DiscoPrepurchaseIncentive({
60
+ apiKey
61
+ }: DiscoPrepurchaseIncentiveProps): import("preact").JSX.Element;
62
+ //#endregion
63
+ //#region src/prepurchase/DiscoPrepurchaseThankYou.d.ts
64
+ type DiscoPrepurchaseThankYouProps = {
65
+ /**
66
+ * The merchant's public API key (a PUBLISHER_CHANNEL `disco_pk_live_…` key).
67
+ * Requests go to Disco's production backend, authenticated by the key.
68
+ */
69
+ apiKey: string;
70
+ };
71
+ /**
72
+ * Disco's prepurchase incentive on the thank-you page.
73
+ *
74
+ * Render it from a `purchase.thank-you.block.render` target. A buyer who opted
75
+ * in at checkout (via `DiscoPrepurchaseIncentive`) has their order submitted
76
+ * and sees the partner's confirmation; anyone else is offered the incentive
77
+ * post-purchase instead.
78
+ *
79
+ * Renders nothing when there is nothing to show, including when the key is
80
+ * rejected.
81
+ */
82
+ declare function DiscoPrepurchaseThankYou({
83
+ apiKey
84
+ }: DiscoPrepurchaseThankYouProps): import("preact").JSX.Element;
85
+ //#endregion
86
+ export { DiscoPrepurchaseIncentive, type DiscoPrepurchaseIncentiveProps, DiscoPrepurchaseThankYou, type DiscoPrepurchaseThankYouProps, DiscoRecommendations, type DiscoRecommendationsProps, type RecommendationsRequest };
41
87
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/DiscoRecommendations.tsx"],"mappings":";;;KAWY,yBAAA;;;;;AAAZ;EAME,MAAA;AAAA;EAkBmC,sDAd/B,QAAA;EACA,OAAA;AAAA;EAaA;;;;AACQ;AAWd;;;;;EAZM,OAAA,EAAS,wBAAsB;EAC/B,QAAA;AAAA;;;;AAcsB;;;;iBAHZ,oBAAA,CAAA;EACd,MAAA;EAAA,GACG;AAAA,GACF,yBAAyB,oBAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/DiscoRecommendations.tsx","../src/prepurchase/DiscoPrepurchaseIncentive.tsx","../src/prepurchase/DiscoPrepurchaseThankYou.tsx"],"mappings":";;;KAWY,yBAAA;;;;;AAAZ;EAME,MAAA;AAAA;EAkBmC,sDAd/B,QAAA;EACA,OAAA;AAAA;EAaA;;;;AACQ;AAWd;;;;;EAZM,OAAA,EAAS,wBAAsB;EAC/B,QAAA;AAAA;;;;AAcsB;;;;iBAHZ,oBAAA,CAAA;EACd,MAAA;EAAA,GACG;AAAA,GACF,yBAAyB,oBAAA,GAAA,CAAA,OAAA;;;KCtChB,8BAAA;;;;;EAKV,MAAM;AAAA;;;;;;;;;;;ADmBM;iBCLE,yBAAA,CAAA;EACd;AAAA,GACC,8BAA8B,oBAAA,GAAA,CAAA,OAAA;;;KCVrB,6BAAA;;;;;EAKV,MAAM;AAAA;;;;;;;;;;;AFQM;iBEME,wBAAA,CAAA;EACd;AAAA,GACC,6BAA6B,oBAAA,GAAA,CAAA,OAAA"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as DiscoRecommendations } from "./DiscoRecommendations-DJBdX34Y.js";
2
- export { DiscoRecommendations };
1
+ import { a as DiscoRecommendations, r as DiscoPrepurchaseIncentive, t as DiscoPrepurchaseThankYou } from "./DiscoPrepurchaseThankYou-0LqiJGuU.js";
2
+ export { DiscoPrepurchaseIncentive, DiscoPrepurchaseThankYou, DiscoRecommendations };
@@ -17,5 +17,35 @@ declare function DiscoRecommendations({
17
17
  widgetId
18
18
  }: DiscoRecommendationsProps): import("preact").JSX.Element;
19
19
  //#endregion
20
- export { DiscoRecommendations, type DiscoRecommendationsProps };
20
+ //#region src/internal/DiscoPrepurchaseIncentive.d.ts
21
+ type DiscoPrepurchaseIncentiveProps = {
22
+ env: DiscoEnv;
23
+ };
24
+ /**
25
+ * Disco's own prepurchase cash-back opt-in, shown in checkout.
26
+ *
27
+ * Unlike the public `DiscoPrepurchaseIncentive`, it takes no API key: the
28
+ * backend resolves the publisher from the shop (the `shop_gid` routes). Only
29
+ * Disco's own extension should render it.
30
+ */
31
+ declare function DiscoPrepurchaseIncentive({
32
+ env
33
+ }: DiscoPrepurchaseIncentiveProps): import("preact").JSX.Element;
34
+ //#endregion
35
+ //#region src/internal/DiscoPrepurchaseThankYou.d.ts
36
+ type DiscoPrepurchaseThankYouProps = {
37
+ env: DiscoEnv;
38
+ };
39
+ /**
40
+ * Disco's own prepurchase incentive on the thank-you page.
41
+ *
42
+ * Unlike the public `DiscoPrepurchaseThankYou`, it takes no API key: the
43
+ * backend resolves the publisher from the shop (the `shop_gid` routes). Only
44
+ * Disco's own extension should render it.
45
+ */
46
+ declare function DiscoPrepurchaseThankYou({
47
+ env
48
+ }: DiscoPrepurchaseThankYouProps): import("preact").JSX.Element;
49
+ //#endregion
50
+ export { DiscoPrepurchaseIncentive, type DiscoPrepurchaseIncentiveProps, DiscoPrepurchaseThankYou, type DiscoPrepurchaseThankYouProps, DiscoRecommendations, type DiscoRecommendationsProps };
21
51
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","names":[],"sources":["../src/internal/DiscoRecommendations.tsx"],"mappings":";;;KAIY,yBAAA;EACV,GAAA,EAAK,QAAQ,EADH;EAGV,QAAA;AAAA;;;;;;AAAQ;AAUV;iBAAgB,oBAAA,CAAA;EACd,GAAA;EACA;AAAA,GACC,yBAAA,oBAAyB,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"internal.d.ts","names":[],"sources":["../src/internal/DiscoRecommendations.tsx","../src/internal/DiscoPrepurchaseIncentive.tsx","../src/internal/DiscoPrepurchaseThankYou.tsx"],"mappings":";;;KAIY,yBAAA;EACV,GAAA,EAAK,QAAQ,EADH;EAGV,QAAA;AAAA;;;;;;AAAQ;AAUV;iBAAgB,oBAAA,CAAA;EACd,GAAA;EACA;AAAA,GACC,yBAAA,oBAAyB,GAAA,CAAA,OAAA;;;KCfhB,8BAAA;EACV,GAAA,EAAK,QAAQ;AAAA;;;;;;;;iBAUC,yBAAA,CAAA;EACd;AAAA,GACC,8BAA8B,oBAAA,GAAA,CAAA,OAAA;;;KCbrB,6BAAA;EACV,GAAA,EAAK,QAAQ;AAAA;;;;;;;;iBAUC,wBAAA,CAAA;EACd;AAAA,GACC,6BAA6B,oBAAA,GAAA,CAAA,OAAA"}
package/dist/internal.js CHANGED
@@ -1,4 +1,5 @@
1
- import { n as Recommendations } from "./DiscoRecommendations-DJBdX34Y.js";
1
+ import { i as PrepurchaseIncentive, n as PrepurchaseThankYou, o as Recommendations } from "./DiscoPrepurchaseThankYou-0LqiJGuU.js";
2
+ import { useMemo } from "preact/hooks";
2
3
  import { jsx } from "preact/jsx-runtime";
3
4
  //#region src/internal/DiscoRecommendations.tsx
4
5
  /**
@@ -15,6 +16,30 @@ function DiscoRecommendations({ env, widgetId }) {
15
16
  });
16
17
  }
17
18
  //#endregion
18
- export { DiscoRecommendations };
19
+ //#region src/internal/DiscoPrepurchaseIncentive.tsx
20
+ /**
21
+ * Disco's own prepurchase cash-back opt-in, shown in checkout.
22
+ *
23
+ * Unlike the public `DiscoPrepurchaseIncentive`, it takes no API key: the
24
+ * backend resolves the publisher from the shop (the `shop_gid` routes). Only
25
+ * Disco's own extension should render it.
26
+ */
27
+ function DiscoPrepurchaseIncentive({ env }) {
28
+ return /* @__PURE__ */ jsx(PrepurchaseIncentive, { auth: useMemo(() => ({ env }), [env]) });
29
+ }
30
+ //#endregion
31
+ //#region src/internal/DiscoPrepurchaseThankYou.tsx
32
+ /**
33
+ * Disco's own prepurchase incentive on the thank-you page.
34
+ *
35
+ * Unlike the public `DiscoPrepurchaseThankYou`, it takes no API key: the
36
+ * backend resolves the publisher from the shop (the `shop_gid` routes). Only
37
+ * Disco's own extension should render it.
38
+ */
39
+ function DiscoPrepurchaseThankYou({ env }) {
40
+ return /* @__PURE__ */ jsx(PrepurchaseThankYou, { auth: useMemo(() => ({ env }), [env]) });
41
+ }
42
+ //#endregion
43
+ export { DiscoPrepurchaseIncentive, DiscoPrepurchaseThankYou, DiscoRecommendations };
19
44
 
20
45
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","names":[],"sources":["../src/internal/DiscoRecommendations.tsx"],"sourcesContent":["import type { DiscoEnv } from \"@disconetwork/core/internal\";\n\nimport { Recommendations } from \"../DiscoRecommendations.js\";\n\nexport type DiscoRecommendationsProps = {\n env: DiscoEnv;\n /** Select a configured widget on the current page. */\n widgetId?: string;\n};\n\n/**\n * Disco's own post-purchase recommendations for a Shopify UI extension.\n *\n * Unlike the public `DiscoRecommendations`, it takes no API key: the backend\n * resolves the publisher from the shop (the `shop_gid` route). Only Disco's\n * own extension should render it.\n */\nexport function DiscoRecommendations({\n env,\n widgetId,\n}: DiscoRecommendationsProps) {\n return <Recommendations auth={{ env }} widgetId={widgetId} />;\n}\n"],"mappings":";;;;;;;;;;AAiBA,SAAgB,qBAAqB,EACnC,KACA,YAC4B;CAC5B,OAAO,oBAAC,iBAAD;EAAiB,MAAM,EAAE,IAAI;EAAa;CAAW,CAAA;AAC9D"}
1
+ {"version":3,"file":"internal.js","names":[],"sources":["../src/internal/DiscoRecommendations.tsx","../src/internal/DiscoPrepurchaseIncentive.tsx","../src/internal/DiscoPrepurchaseThankYou.tsx"],"sourcesContent":["import type { DiscoEnv } from \"@disconetwork/core/internal\";\n\nimport { Recommendations } from \"../DiscoRecommendations.js\";\n\nexport type DiscoRecommendationsProps = {\n env: DiscoEnv;\n /** Select a configured widget on the current page. */\n widgetId?: string;\n};\n\n/**\n * Disco's own post-purchase recommendations for a Shopify UI extension.\n *\n * Unlike the public `DiscoRecommendations`, it takes no API key: the backend\n * resolves the publisher from the shop (the `shop_gid` route). Only Disco's\n * own extension should render it.\n */\nexport function DiscoRecommendations({\n env,\n widgetId,\n}: DiscoRecommendationsProps) {\n return <Recommendations auth={{ env }} widgetId={widgetId} />;\n}\n","import { useMemo } from \"preact/hooks\";\nimport type { DiscoEnv } from \"@disconetwork/core/internal\";\n\nimport { PrepurchaseIncentive } from \"../prepurchase/DiscoPrepurchaseIncentive.js\";\n\nexport type DiscoPrepurchaseIncentiveProps = {\n env: DiscoEnv;\n};\n\n/**\n * Disco's own prepurchase cash-back opt-in, shown in checkout.\n *\n * Unlike the public `DiscoPrepurchaseIncentive`, it takes no API key: the\n * backend resolves the publisher from the shop (the `shop_gid` routes). Only\n * Disco's own extension should render it.\n */\nexport function DiscoPrepurchaseIncentive({\n env,\n}: DiscoPrepurchaseIncentiveProps) {\n const auth = useMemo(() => ({ env }), [env]);\n return <PrepurchaseIncentive auth={auth} />;\n}\n","import { useMemo } from \"preact/hooks\";\nimport type { DiscoEnv } from \"@disconetwork/core/internal\";\n\nimport { PrepurchaseThankYou } from \"../prepurchase/DiscoPrepurchaseThankYou.js\";\n\nexport type DiscoPrepurchaseThankYouProps = {\n env: DiscoEnv;\n};\n\n/**\n * Disco's own prepurchase incentive on the thank-you page.\n *\n * Unlike the public `DiscoPrepurchaseThankYou`, it takes no API key: the\n * backend resolves the publisher from the shop (the `shop_gid` routes). Only\n * Disco's own extension should render it.\n */\nexport function DiscoPrepurchaseThankYou({\n env,\n}: DiscoPrepurchaseThankYouProps) {\n const auth = useMemo(() => ({ env }), [env]);\n return <PrepurchaseThankYou auth={auth} />;\n}\n"],"mappings":";;;;;;;;;;;AAiBA,SAAgB,qBAAqB,EACnC,KACA,YAC4B;CAC5B,OAAO,oBAAC,iBAAD;EAAiB,MAAM,EAAE,IAAI;EAAa;CAAW,CAAA;AAC9D;;;;;;;;;;ACNA,SAAgB,0BAA0B,EACxC,OACiC;CAEjC,OAAO,oBAAC,sBAAD,EAAsB,MADhB,eAAe,EAAE,IAAI,IAAI,CAAC,GAAG,CACJ,EAAI,CAAA;AAC5C;;;;;;;;;;ACLA,SAAgB,yBAAyB,EACvC,OACgC;CAEhC,OAAO,oBAAC,qBAAD,EAAqB,MADf,eAAe,EAAE,IAAI,IAAI,CAAC,GAAG,CACL,EAAI,CAAA;AAC3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disconetwork/shopify",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Disco recommendations for Shopify UI extensions.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,6 +32,8 @@
32
32
  "node": ">=20"
33
33
  },
34
34
  "dependencies": {
35
+ "@tanstack/preact-query": "^5.105.1",
36
+ "zod": "^4.4.3",
35
37
  "@disconetwork/core": "^0.0.18"
36
38
  },
37
39
  "peerDependencies": {
@@ -39,6 +41,7 @@
39
41
  "preact": "^10.10.0"
40
42
  },
41
43
  "devDependencies": {
44
+ "@portabletext/react": "^6.2.0",
42
45
  "@shopify/ui-extensions": "2026.7.4",
43
46
  "@testing-library/preact": "^3.2.4",
44
47
  "eslint": "^9.39.1",
@@ -49,8 +52,8 @@
49
52
  "typescript": "5.9.2",
50
53
  "vitest": "^4.1.7",
51
54
  "@disconetwork/react-shared": "0.0.16",
52
- "@repo/eslint-config": "0.0.0",
53
- "@repo/typescript-config": "0.0.0"
55
+ "@repo/typescript-config": "0.0.0",
56
+ "@repo/eslint-config": "0.0.0"
54
57
  },
55
58
  "scripts": {
56
59
  "build": "tsdown",