commerce-kit 0.32.0 → 0.35.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/dist/api-types.d.ts +34 -4
- package/dist/browser.d.ts +16 -0
- package/dist/browser.js +3 -0
- package/dist/browser.js.map +1 -0
- package/package.json +21 -2
package/dist/api-types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
11
11
|
flags: unknown;
|
|
12
12
|
storeId: string;
|
|
13
13
|
summary: string | null;
|
|
14
|
+
content: JSONContent | null;
|
|
14
15
|
images: string[];
|
|
15
16
|
badge: unknown;
|
|
16
17
|
bundleDiscountPercentage: string | null;
|
|
@@ -253,6 +254,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
253
254
|
flags: unknown;
|
|
254
255
|
storeId: string;
|
|
255
256
|
summary: string | null;
|
|
257
|
+
content: JSONContent | null;
|
|
256
258
|
images: string[];
|
|
257
259
|
badge: unknown;
|
|
258
260
|
bundleDiscountPercentage: string | null;
|
|
@@ -495,6 +497,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
495
497
|
flags: unknown;
|
|
496
498
|
storeId: string;
|
|
497
499
|
summary: string | null;
|
|
500
|
+
content: JSONContent | null;
|
|
498
501
|
images: string[];
|
|
499
502
|
badge: unknown;
|
|
500
503
|
bundleDiscountPercentage: string | null;
|
|
@@ -737,6 +740,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
737
740
|
flags: unknown;
|
|
738
741
|
storeId: string;
|
|
739
742
|
summary: string | null;
|
|
743
|
+
content: JSONContent | null;
|
|
740
744
|
images: string[];
|
|
741
745
|
badge: unknown;
|
|
742
746
|
bundleDiscountPercentage: string | null;
|
|
@@ -980,6 +984,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
980
984
|
flags: unknown;
|
|
981
985
|
storeId: string;
|
|
982
986
|
summary: string | null;
|
|
987
|
+
content: JSONContent | null;
|
|
983
988
|
images: string[];
|
|
984
989
|
badge: unknown;
|
|
985
990
|
bundleDiscountPercentage: string | null;
|
|
@@ -1232,6 +1237,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
1232
1237
|
flags: unknown;
|
|
1233
1238
|
storeId: string;
|
|
1234
1239
|
summary: string | null;
|
|
1240
|
+
content: JSONContent | null;
|
|
1235
1241
|
images: string[];
|
|
1236
1242
|
badge: unknown;
|
|
1237
1243
|
bundleDiscountPercentage: string | null;
|
|
@@ -1474,6 +1480,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
1474
1480
|
flags: unknown;
|
|
1475
1481
|
storeId: string;
|
|
1476
1482
|
summary: string | null;
|
|
1483
|
+
content: JSONContent | null;
|
|
1477
1484
|
images: string[];
|
|
1478
1485
|
badge: unknown;
|
|
1479
1486
|
bundleDiscountPercentage: string | null;
|
|
@@ -1716,6 +1723,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
1716
1723
|
flags: unknown;
|
|
1717
1724
|
storeId: string;
|
|
1718
1725
|
summary: string | null;
|
|
1726
|
+
content: JSONContent | null;
|
|
1719
1727
|
images: string[];
|
|
1720
1728
|
badge: unknown;
|
|
1721
1729
|
bundleDiscountPercentage: string | null;
|
|
@@ -1958,6 +1966,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
1958
1966
|
flags: unknown;
|
|
1959
1967
|
storeId: string;
|
|
1960
1968
|
summary: string | null;
|
|
1969
|
+
content: JSONContent | null;
|
|
1961
1970
|
images: string[];
|
|
1962
1971
|
badge: unknown;
|
|
1963
1972
|
bundleDiscountPercentage: string | null;
|
|
@@ -2201,6 +2210,7 @@ type APIProductsBrowseResult = Omit<{
|
|
|
2201
2210
|
flags: unknown;
|
|
2202
2211
|
storeId: string;
|
|
2203
2212
|
summary: string | null;
|
|
2213
|
+
content: JSONContent | null;
|
|
2204
2214
|
images: string[];
|
|
2205
2215
|
badge: unknown;
|
|
2206
2216
|
bundleDiscountPercentage: string | null;
|
|
@@ -2468,6 +2478,7 @@ type APIProductGetByIdResult = ({
|
|
|
2468
2478
|
flags: unknown;
|
|
2469
2479
|
storeId: string;
|
|
2470
2480
|
summary: string | null;
|
|
2481
|
+
content: JSONContent | null;
|
|
2471
2482
|
images: string[];
|
|
2472
2483
|
badge: unknown;
|
|
2473
2484
|
bundleDiscountPercentage: string | null;
|
|
@@ -2733,6 +2744,7 @@ type APIProductGetByIdResult = ({
|
|
|
2733
2744
|
flags: unknown;
|
|
2734
2745
|
storeId: string;
|
|
2735
2746
|
summary: string | null;
|
|
2747
|
+
content: JSONContent | null;
|
|
2736
2748
|
images: string[];
|
|
2737
2749
|
badge: unknown;
|
|
2738
2750
|
bundleDiscountPercentage: string | null;
|
|
@@ -3061,6 +3073,7 @@ type APICartGetResult = {
|
|
|
3061
3073
|
flags: unknown;
|
|
3062
3074
|
storeId: string;
|
|
3063
3075
|
summary: string | null;
|
|
3076
|
+
content: JSONContent | null;
|
|
3064
3077
|
images: string[];
|
|
3065
3078
|
badge: unknown;
|
|
3066
3079
|
bundleDiscountPercentage: string | null;
|
|
@@ -3480,6 +3493,7 @@ type APICartCreateResult = {
|
|
|
3480
3493
|
flags: unknown;
|
|
3481
3494
|
storeId: string;
|
|
3482
3495
|
summary: string | null;
|
|
3496
|
+
content: JSONContent | null;
|
|
3483
3497
|
images: string[];
|
|
3484
3498
|
badge: unknown;
|
|
3485
3499
|
bundleDiscountPercentage: string | null;
|
|
@@ -3890,6 +3904,7 @@ type APICartRemoveItemResult = {
|
|
|
3890
3904
|
flags: unknown;
|
|
3891
3905
|
storeId: string;
|
|
3892
3906
|
summary: string | null;
|
|
3907
|
+
content: JSONContent | null;
|
|
3893
3908
|
images: string[];
|
|
3894
3909
|
badge: unknown;
|
|
3895
3910
|
bundleDiscountPercentage: string | null;
|
|
@@ -4337,6 +4352,7 @@ type APIOrdersBrowseResult = {
|
|
|
4337
4352
|
storeId: string;
|
|
4338
4353
|
categoryId: string | null;
|
|
4339
4354
|
summary: string | null;
|
|
4355
|
+
content: any;
|
|
4340
4356
|
createdAt: string;
|
|
4341
4357
|
updatedAt: string;
|
|
4342
4358
|
productTaxRate: {
|
|
@@ -4758,6 +4774,7 @@ type APIOrdersBrowseResult = {
|
|
|
4758
4774
|
storeId: string;
|
|
4759
4775
|
categoryId: string | null;
|
|
4760
4776
|
summary: string | null;
|
|
4777
|
+
content: any;
|
|
4761
4778
|
createdAt: string;
|
|
4762
4779
|
updatedAt: string;
|
|
4763
4780
|
productTaxRate: {
|
|
@@ -5194,6 +5211,7 @@ type APIOrderGetByIdResult = {
|
|
|
5194
5211
|
storeId: string;
|
|
5195
5212
|
categoryId: string | null;
|
|
5196
5213
|
summary: string | null;
|
|
5214
|
+
content: any;
|
|
5197
5215
|
createdAt: string;
|
|
5198
5216
|
updatedAt: string;
|
|
5199
5217
|
productTaxRate: {
|
|
@@ -5648,6 +5666,7 @@ type APIOrderGetByIdResult = {
|
|
|
5648
5666
|
storeId: string;
|
|
5649
5667
|
categoryId: string | null;
|
|
5650
5668
|
summary: string | null;
|
|
5669
|
+
content: any;
|
|
5651
5670
|
createdAt: string;
|
|
5652
5671
|
updatedAt: string;
|
|
5653
5672
|
productTaxRate: {
|
|
@@ -6055,6 +6074,7 @@ type APICategoryGetByIdResult = ({
|
|
|
6055
6074
|
flags: unknown;
|
|
6056
6075
|
storeId: string;
|
|
6057
6076
|
summary: string | null;
|
|
6077
|
+
content: JSONContent | null;
|
|
6058
6078
|
images: string[];
|
|
6059
6079
|
badge: unknown;
|
|
6060
6080
|
bundleDiscountPercentage: string | null;
|
|
@@ -6095,6 +6115,7 @@ type APICategoryGetByIdResult = ({
|
|
|
6095
6115
|
flags: unknown;
|
|
6096
6116
|
storeId: string;
|
|
6097
6117
|
summary: string | null;
|
|
6118
|
+
content: JSONContent | null;
|
|
6098
6119
|
images: string[];
|
|
6099
6120
|
badge: unknown;
|
|
6100
6121
|
bundleDiscountPercentage: string | null;
|
|
@@ -6135,6 +6156,7 @@ type APICategoryGetByIdResult = ({
|
|
|
6135
6156
|
flags: unknown;
|
|
6136
6157
|
storeId: string;
|
|
6137
6158
|
summary: string | null;
|
|
6159
|
+
content: JSONContent | null;
|
|
6138
6160
|
images: string[];
|
|
6139
6161
|
badge: unknown;
|
|
6140
6162
|
bundleDiscountPercentage: string | null;
|
|
@@ -6177,6 +6199,7 @@ type APICategoryGetByIdResult = ({
|
|
|
6177
6199
|
flags: unknown;
|
|
6178
6200
|
storeId: string;
|
|
6179
6201
|
summary: string | null;
|
|
6202
|
+
content: JSONContent | null;
|
|
6180
6203
|
images: string[];
|
|
6181
6204
|
badge: unknown;
|
|
6182
6205
|
bundleDiscountPercentage: string | null;
|
|
@@ -6217,6 +6240,7 @@ type APICategoryGetByIdResult = ({
|
|
|
6217
6240
|
flags: unknown;
|
|
6218
6241
|
storeId: string;
|
|
6219
6242
|
summary: string | null;
|
|
6243
|
+
content: JSONContent | null;
|
|
6220
6244
|
images: string[];
|
|
6221
6245
|
badge: unknown;
|
|
6222
6246
|
bundleDiscountPercentage: string | null;
|
|
@@ -6345,6 +6369,7 @@ type APICollectionGetByIdResult = ({
|
|
|
6345
6369
|
flags: unknown;
|
|
6346
6370
|
storeId: string;
|
|
6347
6371
|
summary: string | null;
|
|
6372
|
+
content: JSONContent | null;
|
|
6348
6373
|
images: string[];
|
|
6349
6374
|
badge: unknown;
|
|
6350
6375
|
bundleDiscountPercentage: string | null;
|
|
@@ -6395,6 +6420,7 @@ type APICollectionGetByIdResult = ({
|
|
|
6395
6420
|
flags: unknown;
|
|
6396
6421
|
storeId: string;
|
|
6397
6422
|
summary: string | null;
|
|
6423
|
+
content: JSONContent | null;
|
|
6398
6424
|
images: string[];
|
|
6399
6425
|
badge: unknown;
|
|
6400
6426
|
bundleDiscountPercentage: string | null;
|
|
@@ -6703,8 +6729,8 @@ type APIPostsBrowseResult = {
|
|
|
6703
6729
|
createdAt: string;
|
|
6704
6730
|
slug: string;
|
|
6705
6731
|
active: boolean;
|
|
6706
|
-
title: string;
|
|
6707
6732
|
content: JSONContent;
|
|
6733
|
+
title: string;
|
|
6708
6734
|
tag: string | null;
|
|
6709
6735
|
filters: unknown;
|
|
6710
6736
|
publishedAt: string | null;
|
|
@@ -6731,13 +6757,13 @@ type APIPostGetByIdResult = {
|
|
|
6731
6757
|
slug: string;
|
|
6732
6758
|
active: boolean;
|
|
6733
6759
|
storeId: string;
|
|
6760
|
+
content: JSONContent;
|
|
6734
6761
|
title: string;
|
|
6735
6762
|
seo: {
|
|
6736
6763
|
title?: string | null | undefined;
|
|
6737
6764
|
description?: string | null | undefined;
|
|
6738
6765
|
canonical?: string | null | undefined;
|
|
6739
6766
|
} | null;
|
|
6740
|
-
content: JSONContent;
|
|
6741
6767
|
tag: string | null;
|
|
6742
6768
|
filters: unknown;
|
|
6743
6769
|
publishedAt: string | null;
|
|
@@ -6768,13 +6794,13 @@ type APIPostCreateResult = {
|
|
|
6768
6794
|
slug: string;
|
|
6769
6795
|
active: boolean;
|
|
6770
6796
|
storeId: string;
|
|
6797
|
+
content: JSONContent;
|
|
6771
6798
|
title: string;
|
|
6772
6799
|
seo: {
|
|
6773
6800
|
title?: string | null | undefined;
|
|
6774
6801
|
description?: string | null | undefined;
|
|
6775
6802
|
canonical?: string | null | undefined;
|
|
6776
6803
|
} | null;
|
|
6777
|
-
content: JSONContent;
|
|
6778
6804
|
tag: string | null;
|
|
6779
6805
|
filters: unknown;
|
|
6780
6806
|
publishedAt: string | null;
|
|
@@ -6802,13 +6828,13 @@ type APIPostUpdateResult = {
|
|
|
6802
6828
|
slug: string;
|
|
6803
6829
|
active: boolean;
|
|
6804
6830
|
storeId: string;
|
|
6831
|
+
content: JSONContent;
|
|
6805
6832
|
title: string;
|
|
6806
6833
|
seo: {
|
|
6807
6834
|
title?: string | null | undefined;
|
|
6808
6835
|
description?: string | null | undefined;
|
|
6809
6836
|
canonical?: string | null | undefined;
|
|
6810
6837
|
} | null;
|
|
6811
|
-
content: JSONContent;
|
|
6812
6838
|
tag: string | null;
|
|
6813
6839
|
filters: unknown;
|
|
6814
6840
|
publishedAt: string | null;
|
|
@@ -7105,6 +7131,7 @@ type APIProductCreateBody = {
|
|
|
7105
7131
|
name: string;
|
|
7106
7132
|
slug: string;
|
|
7107
7133
|
description?: string;
|
|
7134
|
+
content?: Record<string, unknown>;
|
|
7108
7135
|
price: number;
|
|
7109
7136
|
images?: string[];
|
|
7110
7137
|
category?: string;
|
|
@@ -7117,6 +7144,7 @@ type APIProductCreateResult = {
|
|
|
7117
7144
|
name: string;
|
|
7118
7145
|
slug: string;
|
|
7119
7146
|
description?: string;
|
|
7147
|
+
content?: Record<string, unknown> | null;
|
|
7120
7148
|
category?: string;
|
|
7121
7149
|
images: string[];
|
|
7122
7150
|
variant: {
|
|
@@ -7129,6 +7157,7 @@ type APIProductCreateResult = {
|
|
|
7129
7157
|
type APIProductUpdateBody = {
|
|
7130
7158
|
title?: string;
|
|
7131
7159
|
description?: string;
|
|
7160
|
+
content?: Record<string, unknown>;
|
|
7132
7161
|
status?: "active" | "draft";
|
|
7133
7162
|
};
|
|
7134
7163
|
type APIProductUpdateQueryParams = {
|
|
@@ -7138,6 +7167,7 @@ type APIProductUpdateResult = {
|
|
|
7138
7167
|
id: string;
|
|
7139
7168
|
title: string;
|
|
7140
7169
|
description: string | null;
|
|
7170
|
+
content: Record<string, unknown> | null;
|
|
7141
7171
|
status: "active" | "draft";
|
|
7142
7172
|
};
|
|
7143
7173
|
type APIProductDeleteQueryParams = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback session toolbar — side-effect entry.
|
|
3
|
+
*
|
|
4
|
+
* Importing `commerce-kit/browser` mounts a floating toolbar onto the page that
|
|
5
|
+
* lets reviewers leave click-anchored comments. Comments persist via YNS API
|
|
6
|
+
* endpoints, authenticated with the `better-auth` session cookie sent through
|
|
7
|
+
* `credentials: "include"`.
|
|
8
|
+
*
|
|
9
|
+
* Disabled in production (`process.env.NEXT_PUBLIC_VERCEL_ENV === "production"`)
|
|
10
|
+
* and when not running in a browser.
|
|
11
|
+
*/
|
|
12
|
+
declare function mountFeedbackToolbar(): {
|
|
13
|
+
unmount: () => void;
|
|
14
|
+
} | null;
|
|
15
|
+
|
|
16
|
+
export { mountFeedbackToolbar };
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{useEffect as y,useRef as L,useState as g}from"react";import{createRoot as N}from"react-dom/client";import{jsx as m,jsxs as h}from"react/jsx-runtime";var E="yns-feedback-toolbar-root",A=()=>{if(typeof window>"u")return null;let e=(process.env.NEXT_PUBLIC_YNS_API_BASE??"").trim();return e?e.replace(/\/$/,""):window.location.origin},B=e=>{if(e.id)return`#${CSS.escape(e.id)}`;let t=[],r=e;for(;r&&r.nodeType===Node.ELEMENT_NODE&&t.length<6;){let n=r.tagName.toLowerCase(),i=r.getAttribute("class");if(i){let d=i.split(/\s+/).filter(Boolean).slice(0,2).map(s=>`.${CSS.escape(s)}`).join("");n+=d}let c=r.parentElement,l=r.tagName;if(c){let d=Array.from(c.children).filter(s=>s.tagName===l);if(d.length>1){let s=d.indexOf(r)+1;n+=`:nth-of-type(${s})`}}t.unshift(n),r=c}return t.join(" > ")},F=["id","class","data-testid","aria-label","role","name","href","src"],v=e=>{let t=[];for(let r of F){let n=e.getAttribute(r);if(!n)continue;let i=n.length>80?`${n.slice(0,80)}\u2026`:n;t.push(` ${r}="${i.replace(/"/g,""")}"`)}return t.join("")},k=e=>{let t=(e.textContent??"").replace(/\s+/g," ").trim();return t?t.length>100?`${t.slice(0,100)}\u2026`:t:""},_=e=>{let t=[],r=e;for(;r&&r!==document.documentElement&&t.length<5;){let s=r.parentElement;if(!s)break;t.unshift(s),r=s}let n=[],i=0;for(let s of t){let p=" ".repeat(i);n.push(`${p}<${s.tagName.toLowerCase()}${v(s)}>`),i++}let c=" ".repeat(i),l=e.tagName.toLowerCase(),d=k(e);if(n.push(`${c}<${l}${v(e)}>${d?`${d}</${l}>`:""} \u2190 TARGET`),!d){let s=" ".repeat(i+1),p=Array.from(e.children).slice(0,6);for(let a of p){let b=k(a);n.push(`${s}<${a.tagName.toLowerCase()}${v(a)}>${b?`${b}</${a.tagName.toLowerCase()}>`:""}`)}e.children.length>6&&n.push(`${s}\u2026 (${e.children.length-6} more children)`),n.push(`${c}</${l}>`)}for(let s=t.length-1;s>=0;s--){let p=" ".repeat(s),a=t[s];a&&n.push(`${p}</${a.tagName.toLowerCase()}>`)}return n.join(`
|
|
2
|
+
`)},z=e=>{let t=e;for(;t;){if(t instanceof HTMLElement&&t.dataset.ynsFeedbackUi==="true")return!0;t=t.parentElement}return!1};function j(){let[e,t]=g(null),[r,n]=g(!0),[i,c]=g(!1),[l,d]=g(null),[s,p]=g(null),a=L(null);y(()=>{if(a.current=A(),!a.current){n(!1);return}let o=new AbortController;return fetch(`${a.current}/api/feedback-comments?host=${encodeURIComponent(window.location.host)}`,{credentials:"include",signal:o.signal}).then(async u=>{if(!u.ok){t(null);return}let f=await u.json();t(f)}).catch(()=>{t(null)}).finally(()=>n(!1)),()=>o.abort()},[]),y(()=>{if(i)return document.body.style.cursor="crosshair",()=>{document.body.style.cursor=""}},[i]),y(()=>{if(!i)return;let o=u=>{let f=u.target;if(!(f instanceof Element)||z(f))return;u.preventDefault(),u.stopPropagation();let S=f.getBoundingClientRect();d({cssSelector:B(f),pagePath:window.location.pathname,surroundingHtml:_(f),rect:{top:S.top+window.scrollY,left:S.left+window.scrollX,width:S.width,height:S.height},clickX:u.clientX+window.scrollX,clickY:u.clientY+window.scrollY}),c(!1)};return document.addEventListener("click",o,{capture:!0}),()=>document.removeEventListener("click",o,{capture:!0})},[i]);let b=async()=>{if(!a.current)return;let o=await fetch(`${a.current}/api/feedback-comments?host=${encodeURIComponent(window.location.host)}`,{credentials:"include"});if(!o.ok)return;let u=await o.json();t(u)},I=async o=>{!a.current||!e||!l||!(await fetch(`${a.current}/api/feedback-comments`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedbackSessionId:e.feedbackSessionId,content:o,pagePath:l.pagePath,cssSelector:l.cssSelector,surroundingHtml:l.surroundingHtml})})).ok||(d(null),await b())},T=async(o,u)=>{!a.current||!(await fetch(`${a.current}/api/feedback-comments/${o}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u})})).ok||(p(null),await b())},R=async o=>{!a.current||!(await fetch(`${a.current}/api/feedback-comments/${o}`,{method:"DELETE",credentials:"include"})).ok||await b()};if(r||!e||!e.canComment)return null;let C=e.comments.filter(o=>o.pagePath===window.location.pathname&&o.status!=="done");return h("div",{"data-yns-feedback-ui":"true",children:[C.map((o,u)=>m(U,{pin:o,number:u+1,editing:s===o.id,onStartEdit:()=>p(o.id),onCancelEdit:()=>p(null),onSave:f=>T(o.id,f),onRemove:()=>R(o.id)},o.id)),l&&m(O,{pending:l,onCancel:()=>d(null),onSave:o=>I(o)}),h("div",{style:D,children:[m("button",{type:"button",onClick:()=>c(o=>!o),style:i?H:$,children:i?"Cancel":"Add comment"}),m("span",{style:M,children:i?"Click any element to comment":`${C.length} on this page`})]})]})}function U({pin:e,number:t,editing:r,onStartEdit:n,onCancelEdit:i,onSave:c,onRemove:l}){let d=X(e.cssSelector);return d?h("div",{style:{position:"absolute",top:d.top,left:d.left,zIndex:2147483600,pointerEvents:"auto"},children:[m("button",{type:"button",onClick:n,style:Y,title:e.content,children:t}),r&&m(x,{initial:e.content,onCancel:i,onSave:c,onRemove:l})]}):null}function O({pending:e,onCancel:t,onSave:r}){return m("div",{style:{position:"absolute",top:e.clickY+10,left:e.clickX+10,zIndex:2147483647},children:m(x,{initial:"",onCancel:t,onSave:r})})}function x({initial:e,onCancel:t,onSave:r,onRemove:n}){let[i,c]=g(e),[l,d]=g(!1);return h("form",{onSubmit:async p=>{p.preventDefault();let a=i.trim();if(a){d(!0);try{await r(a)}finally{d(!1)}}},style:V,children:[m("textarea",{value:i,onChange:p=>c(p.target.value),placeholder:"Leave a comment\u2026",style:q,rows:3}),h("div",{style:W,children:[n&&m("button",{type:"button",onClick:()=>n(),style:K,disabled:l,children:"Delete"}),m("div",{style:{flex:1}}),m("button",{type:"button",onClick:t,style:G,disabled:l,children:"Cancel"}),m("button",{type:"submit",style:J,disabled:l||!i.trim(),children:l?"Saving\u2026":"Save"})]})]})}function X(e){let[t,r]=g(null);return y(()=>{let n=()=>{let c=null;try{c=document.querySelector(e)}catch{c=null}if(!c){r(null);return}let l=c.getBoundingClientRect();r({top:l.top+window.scrollY-12,left:l.left+window.scrollX-12})};n();let i=new ResizeObserver(n);try{let c=document.querySelector(e);c&&i.observe(c)}catch{}return window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),()=>{i.disconnect(),window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n)}},[e]),t}var D={position:"fixed",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:2147483646,display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"rgba(17, 17, 17, 0.92)",color:"white",borderRadius:999,boxShadow:"0 8px 24px rgba(0,0,0,0.25)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,pointerEvents:"auto"},$={border:"none",background:"white",color:"#111",padding:"6px 12px",borderRadius:999,cursor:"pointer",fontWeight:600,fontSize:13},H={...$,background:"#ef4444",color:"white"},M={opacity:.8,fontSize:12},Y={width:24,height:24,borderRadius:999,background:"#10b981",color:"white",border:"2px solid white",cursor:"pointer",fontSize:12,fontWeight:700,boxShadow:"0 2px 6px rgba(0,0,0,0.3)",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},V={background:"white",border:"1px solid #e5e7eb",borderRadius:8,padding:12,width:280,boxShadow:"0 12px 32px rgba(0,0,0,0.18)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',display:"flex",flexDirection:"column",gap:8,color:"#111"},q={width:"100%",border:"1px solid #d1d5db",borderRadius:6,padding:8,fontSize:14,resize:"vertical",fontFamily:"inherit",color:"#111",background:"white",boxSizing:"border-box"},W={display:"flex",alignItems:"center",gap:6},w={border:"1px solid transparent",borderRadius:6,padding:"6px 10px",fontSize:13,cursor:"pointer",fontWeight:500},J={...w,background:"#111",color:"white"},G={...w,background:"transparent",color:"#374151",borderColor:"#d1d5db"},K={...w,background:"transparent",color:"#b91c1c",borderColor:"#fecaca"};function P(){if(typeof window>"u"||process.env.NEXT_PUBLIC_VERCEL_ENV==="production"||document.getElementById(E))return null;let e=document.createElement("div");e.id=E,e.dataset.ynsFeedbackUi="true",document.body.appendChild(e);let t=N(e);return t.render(m(j,{})),{unmount:()=>{t.unmount(),e.remove()}}}typeof window<"u"&&process.env.NEXT_PUBLIC_VERCEL_ENV!=="production"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{P()}):P());export{P as mountFeedbackToolbar};
|
|
3
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/browser.tsx"],"sourcesContent":["/**\n * Feedback session toolbar — side-effect entry.\n *\n * Importing `commerce-kit/browser` mounts a floating toolbar onto the page that\n * lets reviewers leave click-anchored comments. Comments persist via YNS API\n * endpoints, authenticated with the `better-auth` session cookie sent through\n * `credentials: \"include\"`.\n *\n * Disabled in production (`process.env.NEXT_PUBLIC_VERCEL_ENV === \"production\"`)\n * and when not running in a browser.\n */\n\nimport { type CSSProperties, type FormEvent, useEffect, useRef, useState } from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\nconst MOUNT_NODE_ID = \"yns-feedback-toolbar-root\";\n\ninterface FeedbackComment {\n\tid: string;\n\tpagePath: string;\n\tcssSelector: string;\n\tcontent: string;\n\tstatus: \"todo\" | \"done\";\n}\n\ninterface ActiveSession {\n\tfeedbackSessionId: string;\n\tcomments: FeedbackComment[];\n\tcanComment: boolean;\n}\n\ninterface PendingPin {\n\tcssSelector: string;\n\tpagePath: string;\n\tsurroundingHtml: string;\n\trect: { top: number; left: number; width: number; height: number };\n\tclickX: number;\n\tclickY: number;\n}\n\nconst buildApiBase = (): string | null => {\n\tif (typeof window === \"undefined\") return null;\n\t// Same origin by default. Stores can override at build time via\n\t// NEXT_PUBLIC_YNS_API_BASE if their API lives on a different host.\n\tconst override = (process.env.NEXT_PUBLIC_YNS_API_BASE ?? \"\").trim();\n\tif (override) return override.replace(/\\/$/, \"\");\n\treturn window.location.origin;\n};\n\nconst computeCssSelector = (el: Element): string => {\n\tif (el.id) return `#${CSS.escape(el.id)}`;\n\tconst path: string[] = [];\n\tlet node: Element | null = el;\n\twhile (node && node.nodeType === Node.ELEMENT_NODE && path.length < 6) {\n\t\tlet part = node.tagName.toLowerCase();\n\t\tconst className = node.getAttribute(\"class\");\n\t\tif (className) {\n\t\t\tconst classes = className\n\t\t\t\t.split(/\\s+/)\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.slice(0, 2)\n\t\t\t\t.map((c) => `.${CSS.escape(c)}`)\n\t\t\t\t.join(\"\");\n\t\t\tpart += classes;\n\t\t}\n\t\tconst parent: Element | null = node.parentElement;\n\t\tconst tag = node.tagName;\n\t\tif (parent) {\n\t\t\tconst siblings: Element[] = Array.from(parent.children).filter((c) => c.tagName === tag);\n\t\t\tif (siblings.length > 1) {\n\t\t\t\tconst idx = siblings.indexOf(node) + 1;\n\t\t\t\tpart += `:nth-of-type(${idx})`;\n\t\t\t}\n\t\t}\n\t\tpath.unshift(part);\n\t\tnode = parent;\n\t}\n\treturn path.join(\" > \");\n};\n\nconst ATTRS_OF_INTEREST = [\"id\", \"class\", \"data-testid\", \"aria-label\", \"role\", \"name\", \"href\", \"src\"];\n\nconst formatAttrs = (el: Element): string => {\n\tconst parts: string[] = [];\n\tfor (const attr of ATTRS_OF_INTEREST) {\n\t\tconst v = el.getAttribute(attr);\n\t\tif (!v) continue;\n\t\tconst trimmed = v.length > 80 ? `${v.slice(0, 80)}…` : v;\n\t\tparts.push(` ${attr}=\"${trimmed.replace(/\"/g, \""\")}\"`);\n\t}\n\treturn parts.join(\"\");\n};\n\nconst formatTextContent = (el: Element): string => {\n\tconst text = (el.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n\tif (!text) return \"\";\n\treturn text.length > 100 ? `${text.slice(0, 100)}…` : text;\n};\n\n/**\n * Build a compact HTML-like outline of the clicked element + its ancestors and a\n * sample of nearby children. Marks the target with `← TARGET` so the AI agent\n * can locate it later. Output stays small (< 2KB typical).\n */\nconst buildSurroundingHtml = (target: Element): string => {\n\tconst ancestors: Element[] = [];\n\tlet cur: Element | null = target;\n\twhile (cur && cur !== document.documentElement && ancestors.length < 5) {\n\t\tconst parent: Element | null = cur.parentElement;\n\t\tif (!parent) break;\n\t\tancestors.unshift(parent);\n\t\tcur = parent;\n\t}\n\n\tconst lines: string[] = [];\n\tlet depth = 0;\n\tfor (const ancestor of ancestors) {\n\t\tconst indent = \" \".repeat(depth);\n\t\tlines.push(`${indent}<${ancestor.tagName.toLowerCase()}${formatAttrs(ancestor)}>`);\n\t\tdepth++;\n\t}\n\n\tconst targetIndent = \" \".repeat(depth);\n\tconst targetTag = target.tagName.toLowerCase();\n\tconst targetText = formatTextContent(target);\n\tlines.push(\n\t\t`${targetIndent}<${targetTag}${formatAttrs(target)}>${\n\t\t\ttargetText ? `${targetText}</${targetTag}>` : \"\"\n\t\t} ← TARGET`,\n\t);\n\n\tif (!targetText) {\n\t\tconst childIndent = \" \".repeat(depth + 1);\n\t\tconst children = Array.from(target.children).slice(0, 6);\n\t\tfor (const child of children) {\n\t\t\tconst childText = formatTextContent(child);\n\t\t\tlines.push(\n\t\t\t\t`${childIndent}<${child.tagName.toLowerCase()}${formatAttrs(child)}>${\n\t\t\t\t\tchildText ? `${childText}</${child.tagName.toLowerCase()}>` : \"\"\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t\tif (target.children.length > 6) {\n\t\t\tlines.push(`${childIndent}… (${target.children.length - 6} more children)`);\n\t\t}\n\t\tlines.push(`${targetIndent}</${targetTag}>`);\n\t}\n\n\tfor (let i = ancestors.length - 1; i >= 0; i--) {\n\t\tconst indent = \" \".repeat(i);\n\t\tconst ancestor = ancestors[i];\n\t\tif (!ancestor) continue;\n\t\tlines.push(`${indent}</${ancestor.tagName.toLowerCase()}>`);\n\t}\n\n\treturn lines.join(\"\\n\");\n};\n\nconst isInsideToolbar = (el: Element | null): boolean => {\n\tlet node = el;\n\twhile (node) {\n\t\tif (node instanceof HTMLElement && node.dataset.ynsFeedbackUi === \"true\") return true;\n\t\tnode = node.parentElement;\n\t}\n\treturn false;\n};\n\nfunction FeedbackToolbar() {\n\tconst [session, setSession] = useState<ActiveSession | null>(null);\n\tconst [loading, setLoading] = useState(true);\n\tconst [pinMode, setPinMode] = useState(false);\n\tconst [pending, setPending] = useState<PendingPin | null>(null);\n\tconst [editingId, setEditingId] = useState<string | null>(null);\n\tconst apiBase = useRef<string | null>(null);\n\n\tuseEffect(() => {\n\t\tapiBase.current = buildApiBase();\n\t\tif (!apiBase.current) {\n\t\t\tsetLoading(false);\n\t\t\treturn;\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tfetch(`${apiBase.current}/api/feedback-comments?host=${encodeURIComponent(window.location.host)}`, {\n\t\t\tcredentials: \"include\",\n\t\t\tsignal: controller.signal,\n\t\t})\n\t\t\t.then(async (res) => {\n\t\t\t\tif (!res.ok) {\n\t\t\t\t\tsetSession(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst data = (await res.json()) as ActiveSession;\n\t\t\t\tsetSession(data);\n\t\t\t})\n\t\t\t.catch(() => {\n\t\t\t\tsetSession(null);\n\t\t\t})\n\t\t\t.finally(() => setLoading(false));\n\n\t\treturn () => controller.abort();\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!pinMode) return;\n\t\tdocument.body.style.cursor = \"crosshair\";\n\t\treturn () => {\n\t\t\tdocument.body.style.cursor = \"\";\n\t\t};\n\t}, [pinMode]);\n\n\tuseEffect(() => {\n\t\tif (!pinMode) return;\n\t\tconst handleClick = (event: MouseEvent) => {\n\t\t\tconst target = event.target;\n\t\t\tif (!(target instanceof Element)) return;\n\t\t\tif (isInsideToolbar(target)) return;\n\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\n\t\t\tconst rect = target.getBoundingClientRect();\n\t\t\tsetPending({\n\t\t\t\tcssSelector: computeCssSelector(target),\n\t\t\t\tpagePath: window.location.pathname,\n\t\t\t\tsurroundingHtml: buildSurroundingHtml(target),\n\t\t\t\trect: {\n\t\t\t\t\ttop: rect.top + window.scrollY,\n\t\t\t\t\tleft: rect.left + window.scrollX,\n\t\t\t\t\twidth: rect.width,\n\t\t\t\t\theight: rect.height,\n\t\t\t\t},\n\t\t\t\tclickX: event.clientX + window.scrollX,\n\t\t\t\tclickY: event.clientY + window.scrollY,\n\t\t\t});\n\t\t\tsetPinMode(false);\n\t\t};\n\t\tdocument.addEventListener(\"click\", handleClick, { capture: true });\n\t\treturn () => document.removeEventListener(\"click\", handleClick, { capture: true });\n\t}, [pinMode]);\n\n\tconst refreshComments = async () => {\n\t\tif (!apiBase.current) return;\n\t\tconst res = await fetch(\n\t\t\t`${apiBase.current}/api/feedback-comments?host=${encodeURIComponent(window.location.host)}`,\n\t\t\t{ credentials: \"include\" },\n\t\t);\n\t\tif (!res.ok) return;\n\t\tconst data = (await res.json()) as ActiveSession;\n\t\tsetSession(data);\n\t};\n\n\tconst submitNewComment = async (content: string) => {\n\t\tif (!apiBase.current || !session || !pending) return;\n\t\tconst res = await fetch(`${apiBase.current}/api/feedback-comments`, {\n\t\t\tmethod: \"POST\",\n\t\t\tcredentials: \"include\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({\n\t\t\t\tfeedbackSessionId: session.feedbackSessionId,\n\t\t\t\tcontent,\n\t\t\t\tpagePath: pending.pagePath,\n\t\t\t\tcssSelector: pending.cssSelector,\n\t\t\t\tsurroundingHtml: pending.surroundingHtml,\n\t\t\t}),\n\t\t});\n\t\tif (!res.ok) return;\n\t\tsetPending(null);\n\t\tawait refreshComments();\n\t};\n\n\tconst updateComment = async (id: string, content: string) => {\n\t\tif (!apiBase.current) return;\n\t\tconst res = await fetch(`${apiBase.current}/api/feedback-comments/${id}`, {\n\t\t\tmethod: \"PATCH\",\n\t\t\tcredentials: \"include\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({ content }),\n\t\t});\n\t\tif (!res.ok) return;\n\t\tsetEditingId(null);\n\t\tawait refreshComments();\n\t};\n\n\tconst removeComment = async (id: string) => {\n\t\tif (!apiBase.current) return;\n\t\tconst res = await fetch(`${apiBase.current}/api/feedback-comments/${id}`, {\n\t\t\tmethod: \"DELETE\",\n\t\t\tcredentials: \"include\",\n\t\t});\n\t\tif (!res.ok) return;\n\t\tawait refreshComments();\n\t};\n\n\tif (loading || !session || !session.canComment) return null;\n\n\tconst visiblePins = session.comments.filter(\n\t\t(c) => c.pagePath === window.location.pathname && c.status !== \"done\",\n\t);\n\n\treturn (\n\t\t<div data-yns-feedback-ui=\"true\">\n\t\t\t{visiblePins.map((pin, idx) => (\n\t\t\t\t<PinOverlay\n\t\t\t\t\tkey={pin.id}\n\t\t\t\t\tpin={pin}\n\t\t\t\t\tnumber={idx + 1}\n\t\t\t\t\tediting={editingId === pin.id}\n\t\t\t\t\tonStartEdit={() => setEditingId(pin.id)}\n\t\t\t\t\tonCancelEdit={() => setEditingId(null)}\n\t\t\t\t\tonSave={(content) => updateComment(pin.id, content)}\n\t\t\t\t\tonRemove={() => removeComment(pin.id)}\n\t\t\t\t/>\n\t\t\t))}\n\n\t\t\t{pending && (\n\t\t\t\t<PendingCommentPopover\n\t\t\t\t\tpending={pending}\n\t\t\t\t\tonCancel={() => setPending(null)}\n\t\t\t\t\tonSave={(content) => submitNewComment(content)}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t<div style={toolbarStyle}>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={() => setPinMode((v) => !v)}\n\t\t\t\t\tstyle={pinMode ? toolbarButtonActiveStyle : toolbarButtonStyle}\n\t\t\t\t>\n\t\t\t\t\t{pinMode ? \"Cancel\" : \"Add comment\"}\n\t\t\t\t</button>\n\t\t\t\t<span style={toolbarHintStyle}>\n\t\t\t\t\t{pinMode ? \"Click any element to comment\" : `${visiblePins.length} on this page`}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction PinOverlay({\n\tpin,\n\tnumber,\n\tediting,\n\tonStartEdit,\n\tonCancelEdit,\n\tonSave,\n\tonRemove,\n}: {\n\tpin: FeedbackComment;\n\tnumber: number;\n\tediting: boolean;\n\tonStartEdit: () => void;\n\tonCancelEdit: () => void;\n\tonSave: (content: string) => Promise<void>;\n\tonRemove: () => Promise<void>;\n}) {\n\tconst target = useTargetRect(pin.cssSelector);\n\tif (!target) return null;\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\ttop: target.top,\n\t\t\t\tleft: target.left,\n\t\t\t\tzIndex: 2147483600,\n\t\t\t\tpointerEvents: \"auto\",\n\t\t\t}}\n\t\t>\n\t\t\t<button type=\"button\" onClick={onStartEdit} style={pinDotStyle} title={pin.content}>\n\t\t\t\t{number}\n\t\t\t</button>\n\t\t\t{editing && (\n\t\t\t\t<EditPopover initial={pin.content} onCancel={onCancelEdit} onSave={onSave} onRemove={onRemove} />\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nfunction PendingCommentPopover({\n\tpending,\n\tonCancel,\n\tonSave,\n}: {\n\tpending: PendingPin;\n\tonCancel: () => void;\n\tonSave: (content: string) => Promise<void>;\n}) {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\ttop: pending.clickY + 10,\n\t\t\t\tleft: pending.clickX + 10,\n\t\t\t\tzIndex: 2147483647,\n\t\t\t}}\n\t\t>\n\t\t\t<EditPopover initial=\"\" onCancel={onCancel} onSave={onSave} />\n\t\t</div>\n\t);\n}\n\nfunction EditPopover({\n\tinitial,\n\tonCancel,\n\tonSave,\n\tonRemove,\n}: {\n\tinitial: string;\n\tonCancel: () => void;\n\tonSave: (content: string) => Promise<void>;\n\tonRemove?: () => Promise<void>;\n}) {\n\tconst [value, setValue] = useState(initial);\n\tconst [saving, setSaving] = useState(false);\n\n\tconst handleSubmit = async (e: FormEvent) => {\n\t\te.preventDefault();\n\t\tconst content = value.trim();\n\t\tif (!content) return;\n\t\tsetSaving(true);\n\t\ttry {\n\t\t\tawait onSave(content);\n\t\t} finally {\n\t\t\tsetSaving(false);\n\t\t}\n\t};\n\n\treturn (\n\t\t<form onSubmit={handleSubmit} style={popoverStyle}>\n\t\t\t<textarea\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={(e) => setValue(e.target.value)}\n\t\t\t\tplaceholder=\"Leave a comment…\"\n\t\t\t\tstyle={textareaStyle}\n\t\t\t\trows={3}\n\t\t\t/>\n\t\t\t<div style={popoverActionsStyle}>\n\t\t\t\t{onRemove && (\n\t\t\t\t\t<button type=\"button\" onClick={() => onRemove()} style={dangerButtonStyle} disabled={saving}>\n\t\t\t\t\t\tDelete\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t\t<div style={{ flex: 1 }} />\n\t\t\t\t<button type=\"button\" onClick={onCancel} style={ghostButtonStyle} disabled={saving}>\n\t\t\t\t\tCancel\n\t\t\t\t</button>\n\t\t\t\t<button type=\"submit\" style={primaryButtonStyle} disabled={saving || !value.trim()}>\n\t\t\t\t\t{saving ? \"Saving…\" : \"Save\"}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t);\n}\n\nfunction useTargetRect(selector: string) {\n\tconst [rect, setRect] = useState<{ top: number; left: number } | null>(null);\n\n\tuseEffect(() => {\n\t\tconst update = () => {\n\t\t\tlet el: Element | null = null;\n\t\t\ttry {\n\t\t\t\tel = document.querySelector(selector);\n\t\t\t} catch {\n\t\t\t\tel = null;\n\t\t\t}\n\t\t\tif (!el) {\n\t\t\t\tsetRect(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst r = el.getBoundingClientRect();\n\t\t\tsetRect({ top: r.top + window.scrollY - 12, left: r.left + window.scrollX - 12 });\n\t\t};\n\n\t\tupdate();\n\t\tconst ro = new ResizeObserver(update);\n\t\ttry {\n\t\t\tconst el = document.querySelector(selector);\n\t\t\tif (el) ro.observe(el);\n\t\t} catch {\n\t\t\t// swallow invalid selector\n\t\t}\n\t\twindow.addEventListener(\"scroll\", update, true);\n\t\twindow.addEventListener(\"resize\", update);\n\t\treturn () => {\n\t\t\tro.disconnect();\n\t\t\twindow.removeEventListener(\"scroll\", update, true);\n\t\t\twindow.removeEventListener(\"resize\", update);\n\t\t};\n\t}, [selector]);\n\n\treturn rect;\n}\n\n// Inline styles — toolbar is injected into arbitrary stores, so we avoid relying\n// on any CSS framework being present.\nconst toolbarStyle: CSSProperties = {\n\tposition: \"fixed\",\n\tbottom: 16,\n\tleft: \"50%\",\n\ttransform: \"translateX(-50%)\",\n\tzIndex: 2147483646,\n\tdisplay: \"flex\",\n\talignItems: \"center\",\n\tgap: 12,\n\tpadding: \"8px 12px\",\n\tbackground: \"rgba(17, 17, 17, 0.92)\",\n\tcolor: \"white\",\n\tborderRadius: 999,\n\tboxShadow: \"0 8px 24px rgba(0,0,0,0.25)\",\n\tfontFamily:\n\t\t'-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\"',\n\tfontSize: 14,\n\tpointerEvents: \"auto\",\n};\n\nconst toolbarButtonStyle: CSSProperties = {\n\tborder: \"none\",\n\tbackground: \"white\",\n\tcolor: \"#111\",\n\tpadding: \"6px 12px\",\n\tborderRadius: 999,\n\tcursor: \"pointer\",\n\tfontWeight: 600,\n\tfontSize: 13,\n};\n\nconst toolbarButtonActiveStyle: CSSProperties = {\n\t...toolbarButtonStyle,\n\tbackground: \"#ef4444\",\n\tcolor: \"white\",\n};\n\nconst toolbarHintStyle: CSSProperties = {\n\topacity: 0.8,\n\tfontSize: 12,\n};\n\nconst pinDotStyle: CSSProperties = {\n\twidth: 24,\n\theight: 24,\n\tborderRadius: 999,\n\tbackground: \"#10b981\",\n\tcolor: \"white\",\n\tborder: \"2px solid white\",\n\tcursor: \"pointer\",\n\tfontSize: 12,\n\tfontWeight: 700,\n\tboxShadow: \"0 2px 6px rgba(0,0,0,0.3)\",\n\tdisplay: \"inline-flex\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tpadding: 0,\n};\n\nconst popoverStyle: CSSProperties = {\n\tbackground: \"white\",\n\tborder: \"1px solid #e5e7eb\",\n\tborderRadius: 8,\n\tpadding: 12,\n\twidth: 280,\n\tboxShadow: \"0 12px 32px rgba(0,0,0,0.18)\",\n\tfontFamily:\n\t\t'-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\"',\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tgap: 8,\n\tcolor: \"#111\",\n};\n\nconst textareaStyle: CSSProperties = {\n\twidth: \"100%\",\n\tborder: \"1px solid #d1d5db\",\n\tborderRadius: 6,\n\tpadding: 8,\n\tfontSize: 14,\n\tresize: \"vertical\",\n\tfontFamily: \"inherit\",\n\tcolor: \"#111\",\n\tbackground: \"white\",\n\tboxSizing: \"border-box\",\n};\n\nconst popoverActionsStyle: CSSProperties = {\n\tdisplay: \"flex\",\n\talignItems: \"center\",\n\tgap: 6,\n};\n\nconst baseButton: CSSProperties = {\n\tborder: \"1px solid transparent\",\n\tborderRadius: 6,\n\tpadding: \"6px 10px\",\n\tfontSize: 13,\n\tcursor: \"pointer\",\n\tfontWeight: 500,\n};\n\nconst primaryButtonStyle: CSSProperties = {\n\t...baseButton,\n\tbackground: \"#111\",\n\tcolor: \"white\",\n};\n\nconst ghostButtonStyle: CSSProperties = {\n\t...baseButton,\n\tbackground: \"transparent\",\n\tcolor: \"#374151\",\n\tborderColor: \"#d1d5db\",\n};\n\nconst dangerButtonStyle: CSSProperties = {\n\t...baseButton,\n\tbackground: \"transparent\",\n\tcolor: \"#b91c1c\",\n\tborderColor: \"#fecaca\",\n};\n\nexport function mountFeedbackToolbar(): { unmount: () => void } | null {\n\tif (typeof window === \"undefined\") return null;\n\tif (process.env.NEXT_PUBLIC_VERCEL_ENV === \"production\") return null;\n\tif (document.getElementById(MOUNT_NODE_ID)) return null;\n\n\tconst container = document.createElement(\"div\");\n\tcontainer.id = MOUNT_NODE_ID;\n\tcontainer.dataset.ynsFeedbackUi = \"true\";\n\tdocument.body.appendChild(container);\n\n\tconst root = createRoot(container);\n\troot.render(<FeedbackToolbar />);\n\n\treturn {\n\t\tunmount: () => {\n\t\t\troot.unmount();\n\t\t\tcontainer.remove();\n\t\t},\n\t};\n}\n\n// Auto-mount on import. Wait for DOM ready.\nif (typeof window !== \"undefined\" && process.env.NEXT_PUBLIC_VERCEL_ENV !== \"production\") {\n\tif (document.readyState === \"loading\") {\n\t\tdocument.addEventListener(\"DOMContentLoaded\", () => {\n\t\t\tmountFeedbackToolbar();\n\t\t});\n\t} else {\n\t\tmountFeedbackToolbar();\n\t}\n}\n"],"mappings":"AAYA,OAA6C,aAAAA,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QAChF,OAAS,cAAAC,MAAkB,mBAkSvB,cAAAC,EAoBD,QAAAC,MApBC,oBAhSJ,IAAMC,EAAgB,4BAyBhBC,EAAe,IAAqB,CACzC,GAAI,OAAO,OAAW,IAAa,OAAO,KAG1C,IAAMC,GAAY,QAAQ,IAAI,0BAA4B,IAAI,KAAK,EACnE,OAAIA,EAAiBA,EAAS,QAAQ,MAAO,EAAE,EACxC,OAAO,SAAS,MACxB,EAEMC,EAAsBC,GAAwB,CACnD,GAAIA,EAAG,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R,aAAc,EACd,QAAS,GACT,MAAO,IACP,UAAW,+BACX,WACC,6HACD,QAAS,OACT,cAAe,SACf,IAAK,EACL,MAAO,MACR,EAEMC,EAA+B,CACpC,MAAO,OACP,OAAQ,oBACR,aAAc,EACd,QAAS,EACT,SAAU,GACV,OAAQ,WACR,WAAY,UACZ,MAAO,OACP,WAAY,QACZ,UAAW,YACZ,EAEMC,EAAqC,CAC1C,QAAS,OACT,WAAY,SACZ,IAAK,CACN,EAEMS,EAA4B,CACjC,OAAQ,wBACR,aAAc,EACd,QAAS,WACT,SAAU,GACV,OAAQ,UACR,WAAY,GACb,EAEMN,EAAoC,CACzC,GAAGM,EACH,WAAY,OACZ,MAAO,OACR,EAEMP,EAAkC,CACvC,GAAGO,EACH,WAAY,cACZ,MAAO,UACP,YAAa,SACd,EAEMR,EAAmC,CACxC,GAAGQ,EACH,WAAY,cACZ,MAAO,UACP,YAAa,SACd,EAEO,SAASC,GAAuD,CAGtE,GAFI,OAAO,OAAW,KAClB,QAAQ,IAAI,yBAA2B,cACvC,SAAS,eAAepG,CAAa,EAAG,OAAO,KAEnD,IAAMqG,EAAY,SAAS,cAAc,KAAK,EAC9CA,EAAU,GAAKrG,EACfqG,EAAU,QAAQ,cAAgB,OAClC,SAAS,KAAK,YAAYA,CAAS,EAEnC,IAAMC,EAAOzG,EAAWwG,CAAS,EACjC,OAAAC,EAAK,OAAOxG,EAAC0C,EAAA,EAAgB,CAAE,EAExB,CACN,QAAS,IAAM,CACd8D,EAAK,QAAQ,EACbD,EAAU,OAAO,CAClB,CACD,CACD,CAGI,OAAO,OAAW,KAAe,QAAQ,IAAI,yBAA2B,eACvE,SAAS,aAAe,UAC3B,SAAS,iBAAiB,mBAAoB,IAAM,CACnDD,EAAqB,CACtB,CAAC,EAEDA,EAAqB","names":["useEffect","useRef","useState","createRoot","jsx","jsxs","MOUNT_NODE_ID","buildApiBase","override","computeCssSelector","el","path","node","part","className","classes","c","parent","tag","siblings","idx","ATTRS_OF_INTEREST","formatAttrs","parts","attr","v","trimmed","formatTextContent","text","buildSurroundingHtml","target","ancestors","cur","lines","depth","ancestor","indent","targetIndent","targetTag","targetText","childIndent","children","child","childText","i","isInsideToolbar","FeedbackToolbar","session","setSession","loading","setLoading","pinMode","setPinMode","pending","setPending","editingId","setEditingId","apiBase","controller","res","data","handleClick","event","rect","refreshComments","submitNewComment","content","updateComment","id","removeComment","visiblePins","pin","PinOverlay","PendingCommentPopover","toolbarStyle","toolbarButtonActiveStyle","toolbarButtonStyle","toolbarHintStyle","number","editing","onStartEdit","onCancelEdit","onSave","onRemove","useTargetRect","pinDotStyle","EditPopover","onCancel","initial","value","setValue","saving","setSaving","e","popoverStyle","textareaStyle","popoverActionsStyle","dangerButtonStyle","ghostButtonStyle","primaryButtonStyle","selector","setRect","update","r","ro","baseButton","mountFeedbackToolbar","container","root"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "commerce-kit",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"keywords": [
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"import": "./dist/index.js",
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./browser": {
|
|
28
|
+
"import": "./dist/browser.js",
|
|
29
|
+
"types": "./dist/browser.d.ts",
|
|
30
|
+
"default": "./dist/browser.js"
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"files": [
|
|
@@ -31,7 +36,9 @@
|
|
|
31
36
|
"README.md",
|
|
32
37
|
"LICENSE.md"
|
|
33
38
|
],
|
|
34
|
-
"sideEffects":
|
|
39
|
+
"sideEffects": [
|
|
40
|
+
"./dist/browser.js"
|
|
41
|
+
],
|
|
35
42
|
"scripts": {
|
|
36
43
|
"dev": "tsup --config tsup.config.ts --watch",
|
|
37
44
|
"lint": "biome check --write --unsafe",
|
|
@@ -44,9 +51,13 @@
|
|
|
44
51
|
"devDependencies": {
|
|
45
52
|
"@biomejs/biome": "2.3.14",
|
|
46
53
|
"@types/node": "^24.10.10",
|
|
54
|
+
"@types/react": "^19.0.0",
|
|
55
|
+
"@types/react-dom": "^19.0.0",
|
|
47
56
|
"@typescript/native-preview": "7.0.0-dev.20260203.1",
|
|
48
57
|
"husky": "9.1.7",
|
|
49
58
|
"lint-staged": "16.2.7",
|
|
59
|
+
"react": "^19.0.0",
|
|
60
|
+
"react-dom": "^19.0.0",
|
|
50
61
|
"rimraf": "6.1.2",
|
|
51
62
|
"tsup": "8.5.1",
|
|
52
63
|
"tsx": "^4.21.0",
|
|
@@ -55,6 +66,8 @@
|
|
|
55
66
|
},
|
|
56
67
|
"peerDependencies": {
|
|
57
68
|
"@types/node": "^24.10.10",
|
|
69
|
+
"react": "^19",
|
|
70
|
+
"react-dom": "^19",
|
|
58
71
|
"typescript": "5.9.3",
|
|
59
72
|
"@typescript/native-preview": "7.0.0-dev.20251022.1",
|
|
60
73
|
"zod": "^4.3.6"
|
|
@@ -65,6 +78,12 @@
|
|
|
65
78
|
},
|
|
66
79
|
"@typescript/native-preview": {
|
|
67
80
|
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"react": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"react-dom": {
|
|
86
|
+
"optional": true
|
|
68
87
|
}
|
|
69
88
|
},
|
|
70
89
|
"peerDependencyRules": {
|