@teddy-dev/frontend 1.0.1

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.
Files changed (112) hide show
  1. package/algolia/algolia-loader.js +56 -0
  2. package/algolia/algolia-search.js +222 -0
  3. package/auth/teddy-auth-login.js +29 -0
  4. package/auth/teddy-auth-profile.js +58 -0
  5. package/auth/teddy-auth-register.js +52 -0
  6. package/auth/teddy-auth-reset.js +39 -0
  7. package/auth/teddy-auth.js +92 -0
  8. package/bantoa/bantoa-product.js +64 -0
  9. package/bantoa/bantoa-search.js +46 -0
  10. package/bantoa/bantoa-stylemix.js +43 -0
  11. package/bantoa/bantoa.js +21 -0
  12. package/cart/teddy-cart-controller.js +163 -0
  13. package/cart/teddy-cart-customer.js +86 -0
  14. package/cart/teddy-cart-discounts.js +55 -0
  15. package/cart/teddy-cart-promo-apply.js +24 -0
  16. package/cart/teddy-cart-promo-error.js +38 -0
  17. package/cart/teddy-cart-promo-loading.js +20 -0
  18. package/cart/teddy-cart-promo.js +96 -0
  19. package/components/mc-btn.js +38 -0
  20. package/components/mc-card-render.js +33 -0
  21. package/components/mc-cart-counter.js +14 -0
  22. package/components/mc-cart-error.js +35 -0
  23. package/components/mc-cart-quantity.js +43 -0
  24. package/components/mc-cart-remove.js +32 -0
  25. package/components/mc-copy.js +33 -0
  26. package/components/mc-element.js +84 -0
  27. package/components/mc-form-errors.js +35 -0
  28. package/components/mc-form-success.js +31 -0
  29. package/components/mc-form.js +223 -0
  30. package/components/mc-input-area.js +13 -0
  31. package/components/mc-input-checkbox-group.js +52 -0
  32. package/components/mc-input-checkbox.js +12 -0
  33. package/components/mc-input-password.js +39 -0
  34. package/components/mc-input-places.js +43 -0
  35. package/components/mc-input-quantity.js +43 -0
  36. package/components/mc-input-select.js +14 -0
  37. package/components/mc-input-text.js +12 -0
  38. package/components/mc-input.js +137 -0
  39. package/components/mc-loader.js +21 -0
  40. package/components/mc-modal.js +69 -0
  41. package/components/mc-password-eye.js +24 -0
  42. package/components/mc-password-tips.js +60 -0
  43. package/components/mc-qrcode.js +41 -0
  44. package/components/mc-range.js +108 -0
  45. package/components/mc-read-more.js +56 -0
  46. package/components/mc-recommended.js +50 -0
  47. package/components/mc-referrer.js +20 -0
  48. package/components/mc-splash-controller.js +32 -0
  49. package/components/mc-splash-link.js +65 -0
  50. package/components/mc-stoq.js +30 -0
  51. package/components/mc-swiper.js +333 -0
  52. package/components/mc-video.js +61 -0
  53. package/css/bootstrap-lg.css +2762 -0
  54. package/css/bootstrap-lg.min.css +1 -0
  55. package/css/bootstrap-md.css +2762 -0
  56. package/css/bootstrap-md.min.css +1 -0
  57. package/css/bootstrap-sm.css +2762 -0
  58. package/css/bootstrap-sm.min.css +1 -0
  59. package/css/bootstrap-xl.css +2790 -0
  60. package/css/bootstrap-xl.min.css +1 -0
  61. package/css/bootstrap-xxl.css +2762 -0
  62. package/css/bootstrap-xxl.min.css +1 -0
  63. package/css/bootstrap.css +9824 -0
  64. package/css/bootstrap.min.css +5 -0
  65. package/css/mc-form-errors.css +3 -0
  66. package/css/mc-loader.css +6 -0
  67. package/css/mc-password-eye.css +6 -0
  68. package/css/mc-password-tips.css +6 -0
  69. package/css/mc-read-more.css +14 -0
  70. package/css/mc-video.css +4 -0
  71. package/css/mc-wishlist-hero-btn.css +7 -0
  72. package/loader.js +110 -0
  73. package/loyalty/teddy-loyalty-create.js +40 -0
  74. package/loyalty/teddy-loyalty-redeem.js +38 -0
  75. package/loyalty/teddy-loyalty.js +214 -0
  76. package/package.json +20 -0
  77. package/res/mc-events.js +43 -0
  78. package/res/mc-shopify.js +439 -0
  79. package/res/mc-utils.js +119 -0
  80. package/res/mc-vue.js +9350 -0
  81. package/returns/teddy-return-iban.js +115 -0
  82. package/returns/teddy-return-list.js +165 -0
  83. package/returns/teddy-return-request.js +353 -0
  84. package/scripts/publish-store.js +62 -0
  85. package/test/auth-login-error.json +4 -0
  86. package/test/auth-login-success.json +13 -0
  87. package/test/auth-password-change-error.json +4 -0
  88. package/test/auth-password-change-success.json +3 -0
  89. package/test/auth-register-error.json +4 -0
  90. package/test/auth-register-success.json +12 -0
  91. package/test/auth-reset-error.json +4 -0
  92. package/test/auth-reset-success.json +3 -0
  93. package/test/loyalty-error.json +4 -0
  94. package/test/loyalty-noinfo.json +18 -0
  95. package/test/loyalty-redeem-error.json +4 -0
  96. package/test/loyalty-redeem-success.json +11 -0
  97. package/test/loyalty-success.json +143 -0
  98. package/test/returns-create-success.json +1 -0
  99. package/test/returns-get-success.json +35 -0
  100. package/test/returns-get-tracking.json +30 -0
  101. package/test/returns-list-empty.json +4 -0
  102. package/test/returns-list-success.json +59 -0
  103. package/test/returns-search-manual.json +67 -0
  104. package/test/returns-search-success.json +76 -0
  105. package/test/wishlist-error.json +4 -0
  106. package/test/wishlist-success.json +3 -0
  107. package/wishlist/teddy-wishlist-btn.js +55 -0
  108. package/wishlist/teddy-wishlist-clear.js +18 -0
  109. package/wishlist/teddy-wishlist-counter.js +35 -0
  110. package/wishlist/teddy-wishlist-item.js +46 -0
  111. package/wishlist/teddy-wishlist-page.js +59 -0
  112. package/wishlist/teddy-wishlist.js +131 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "success": true,
3
+ "multipassUrl": "/",
4
+ "customer": {
5
+ "idmId": "string",
6
+ "shopifyId": "gid://shopify/Customer/123",
7
+ "cardNumber": "string",
8
+ "score": 150,
9
+ "cartId": "gid://shopify/Cart/789"
10
+ },
11
+ "cartMerged": true,
12
+ "error": null
13
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "success": false,
3
+ "error": "Invalid email address"
4
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "success": true
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "success": false,
3
+ "error": "Registration failed"
4
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "success": true,
3
+ "multipassUrl": "/",
4
+ "customer": {
5
+ "idmId": "string",
6
+ "shopifyId": "gid://shopify/Customer/123",
7
+ "cardNumber": "string",
8
+ "score": 0,
9
+ "cartId": "gid://shopify/Cart/456"
10
+ },
11
+ "error": null
12
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "success": false,
3
+ "error": "Invalid email address"
4
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "success": true
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "success": false,
3
+ "error": "No info"
4
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "success": true,
3
+ "customer": {
4
+ "id": "gid://shopify/Customer/123",
5
+ "email": "customer@example.com"
6
+ },
7
+ "loyalty": {
8
+ },
9
+ "performance": {
10
+ "responseTime": 125,
11
+ "cached": true,
12
+ "cacheKeys": [
13
+ "loyalty:info:123",
14
+ "loyalty:promos:123",
15
+ "loyalty:movements:123:1"
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "success": false,
3
+ "error": "50 punti non aggiunti."
4
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "success": true,
3
+ "redemption": {
4
+ "pointsAdded": 50,
5
+ "previousBalance": 248,
6
+ "newBalance": 298,
7
+ "couponType": "EXTRA_POINTS",
8
+ "expiryDate": null
9
+ },
10
+ "message": "50 punti aggiunti con successo!"
11
+ }
@@ -0,0 +1,143 @@
1
+ {
2
+ "success": true,
3
+ "customer": {
4
+ "id": "gid://shopify/Customer/123",
5
+ "email": "customer@example.com"
6
+ },
7
+ "loyalty": {
8
+ "info": {
9
+ "barcode": "10001000000000465606",
10
+ "currentPoints": 248,
11
+ "tier": {
12
+ "current": "GOLD",
13
+ "name": "Gold Member",
14
+ "benefits": ["10% extra points", "Free shipping"]
15
+ },
16
+ "nextTier": {
17
+ "name": "PLATINUM",
18
+ "pointsRequired": 500,
19
+ "pointsToNext": 252
20
+ },
21
+ "expiringPoints": {
22
+ "amount": 50,
23
+ "date": "2025-12-31"
24
+ },
25
+ "lifetime": {
26
+ "pointsEarned": 1548,
27
+ "pointsSpent": 1300
28
+ }
29
+ },
30
+ "promotions": [
31
+ {
32
+ "id": 58019,
33
+ "name": "Sconto Compleanno",
34
+ "description": "20% di sconto nel mese del compleanno",
35
+ "type": "PERSONAL",
36
+ "validFrom": "2025-07-01",
37
+ "validTo": "2025-07-31",
38
+ "couponCode": "BDAY20",
39
+ "imageUrl": "https://cdn.example.com/promo/bday.jpg",
40
+ "terms": ["Non cumulabile", "Minimo €30"]
41
+ },
42
+ {
43
+ "id": 58020,
44
+ "name": "Riscatta 200 punti",
45
+ "description": "Ottieni €10 di sconto",
46
+ "type": "POINTS_REDEMPTION",
47
+ "pointsRequired": 200,
48
+ "value": 10.00,
49
+ "available": true
50
+ }
51
+ ],
52
+ "movements": {
53
+ "items": [
54
+ {
55
+ "id": 233458798,
56
+ "date": "2025-07-01T16:48:01.053Z",
57
+ "type": "PURCHASE",
58
+ "points": 48,
59
+ "description": "Acquisto online #1001",
60
+ "orderId": "gid://shopify/Order/1001",
61
+ "shopCode": "WEB",
62
+ "balanceAfter": 248
63
+ },
64
+ {
65
+ "id": 233458797,
66
+ "date": "2025-06-28T10:30:00.000Z",
67
+ "type": "REDEMPTION",
68
+ "points": -200,
69
+ "description": "Riscatto buono €10",
70
+ "couponCode": "POINTS10",
71
+ "balanceAfter": 200
72
+ },
73
+ {
74
+ "id": 233458798,
75
+ "date": "2025-07-01T16:48:01.053Z",
76
+ "type": "PURCHASE",
77
+ "points": 48,
78
+ "description": "Acquisto online #1001",
79
+ "orderId": "gid://shopify/Order/1001",
80
+ "shopCode": "WEB",
81
+ "balanceAfter": 248
82
+ },
83
+ {
84
+ "id": 233458798,
85
+ "date": "2025-07-01T16:48:01.053Z",
86
+ "type": "PURCHASE",
87
+ "points": 48,
88
+ "description": "Acquisto online #1001",
89
+ "orderId": "gid://shopify/Order/1001",
90
+ "shopCode": "WEB",
91
+ "balanceAfter": 248
92
+ },
93
+ {
94
+ "id": 233458798,
95
+ "date": "2025-07-03T16:48:01.053Z",
96
+ "type": "PURCHASE",
97
+ "points": 48,
98
+ "description": "Acquisto online #1001",
99
+ "orderId": "gid://shopify/Order/1001",
100
+ "shopCode": "WEB",
101
+ "balanceAfter": 248
102
+ },
103
+ {
104
+ "id": 233458798,
105
+ "date": "2025-07-02T16:48:01.053Z",
106
+ "type": "PURCHASE",
107
+ "points": 48,
108
+ "description": "Acquisto online #1001",
109
+ "orderId": "gid://shopify/Order/1001",
110
+ "shopCode": "WEB",
111
+ "balanceAfter": 248
112
+ },
113
+ {
114
+ "id": 233458798,
115
+ "date": "2025-07-02T16:48:01.053Z",
116
+ "type": "PURCHASE",
117
+ "points": 48,
118
+ "description": "Acquisto online #1001",
119
+ "orderId": "gid://shopify/Order/1001",
120
+ "shopCode": "WEB",
121
+ "balanceAfter": 248
122
+ }
123
+ ],
124
+ "pagination": {
125
+ "page": 1,
126
+ "limit": 20,
127
+ "total": 156,
128
+ "totalPages": 8,
129
+ "hasNext": true,
130
+ "hasPrev": false
131
+ }
132
+ }
133
+ },
134
+ "performance": {
135
+ "responseTime": 125,
136
+ "cached": true,
137
+ "cacheKeys": [
138
+ "loyalty:info:123",
139
+ "loyalty:promos:123",
140
+ "loyalty:movements:123:1"
141
+ ]
142
+ }
143
+ }
@@ -0,0 +1 @@
1
+ {"return_id":10280829149,"success":true}
@@ -0,0 +1,35 @@
1
+ {
2
+ "return": {
3
+ "return_id": 10280829149,
4
+ "return_name": "#1029-R1",
5
+ "return_status": "OPEN",
6
+ "created_at": "2025-07-28T10:24:38Z",
7
+ "total_quantity": 2,
8
+ "total_amount": 0.0,
9
+ "order_name": "#1029",
10
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/da41071958309b60434b58adab9f7333/authenticate?key=03c39e0292b40917d012c42410b6fec0",
11
+ "lines": [
12
+ {
13
+ "title": "42",
14
+ "product_title": "Bermuda Uomo Regular-Fit Pinces QB24",
15
+ "color": "Beige",
16
+ "sku": "CFC0120710003B1172",
17
+ "quantity": 1,
18
+ "price": 0.0,
19
+ "image": "https://cdn.shopify.com/s/files/1/0755/7572/2205/files/c651c78e7ab3a6ee4be30c202e27a5d1ff9082df_CFC0120710003B117_8faa2996-cdd3-43c0-b4a9-115c40e0b4e9.jpg?v=1746018844"
20
+ },
21
+ {
22
+ "title": "50",
23
+ "product_title": "Bermuda Uomo Regular-Fit Pinces QB24",
24
+ "color": "Beige",
25
+ "sku": "CFC0120710003B1176",
26
+ "quantity": 1,
27
+ "price": 0.0,
28
+ "image": "https://cdn.shopify.com/s/files/1/0755/7572/2205/files/c651c78e7ab3a6ee4be30c202e27a5d1ff9082df_CFC0120710003B117_8faa2996-cdd3-43c0-b4a9-115c40e0b4e9.jpg?v=1746018844"
29
+ }
30
+ ],
31
+ "tracking": null,
32
+ "refund": null
33
+ },
34
+ "success": true
35
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "return": {
3
+ "return_id": 9929261277,
4
+ "return_name": "#1025-R1",
5
+ "return_status": "OPEN",
6
+ "created_at": "2025-07-07T14:46:39Z",
7
+ "total_quantity": 1,
8
+ "total_amount": 0.0,
9
+ "order_name": "#1025",
10
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/5ebdd88a91e9725e06ef57186786d9a2/authenticate?key=749c827e064ba21a3ee620259a96ee33",
11
+ "lines": [
12
+ {
13
+ "title": "M",
14
+ "product_title": "Camicia Classica Uomo Collo alla Francese QB24",
15
+ "color": null,
16
+ "sku": "CFC0117256003B0614",
17
+ "quantity": 1,
18
+ "price": 0.0,
19
+ "image": "https://cdn.shopify.com/s/files/1/0755/7572/2205/files/7b67132d0d1f23e0e121181a9b2f2792e40003dc_CFC0117256003B061_76d84091-93ad-4451-b3e6-2db65b71b7fb.jpg?v=1746018844"
20
+ }
21
+ ],
22
+ "tracking": {
23
+ "carrier": "Nome corriere",
24
+ "tracking_number": "ABC124",
25
+ "tracking_url": "https://www.google.com/?hl=it"
26
+ },
27
+ "refund": null
28
+ },
29
+ "success": true
30
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "returns": [],
3
+ "success": true
4
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "returns": [
3
+ {
4
+ "return_id": 10280829149,
5
+ "return_name": "#1029-R1",
6
+ "return_status": "OPEN",
7
+ "created_at": "2025-07-28T10:24:38Z",
8
+ "total_quantity": 2,
9
+ "order_name": "#1029",
10
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/da41071958309b60434b58adab9f7333/authenticate?key=03c39e0292b40917d012c42410b6fec0"
11
+ },
12
+ {
13
+ "return_id": 9929326813,
14
+ "return_name": "#1026-R1",
15
+ "return_status": "CLOSED",
16
+ "created_at": "2025-07-07T14:48:47Z",
17
+ "total_quantity": 1,
18
+ "order_name": "#1026",
19
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/490fabb278d9034c405bc73718e62c17/authenticate?key=c98928e776a2fe68244855303a6f0e95"
20
+ },
21
+ {
22
+ "return_id": 9929261277,
23
+ "return_name": "#1025-R1",
24
+ "return_status": "OPEN",
25
+ "created_at": "2025-07-07T14:46:39Z",
26
+ "total_quantity": 1,
27
+ "order_name": "#1025",
28
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/5ebdd88a91e9725e06ef57186786d9a2/authenticate?key=749c827e064ba21a3ee620259a96ee33"
29
+ },
30
+ {
31
+ "return_id": 9928999133,
32
+ "return_name": "#1024-R1",
33
+ "return_status": "CLOSED",
34
+ "created_at": "2025-07-07T14:36:09Z",
35
+ "total_quantity": 1,
36
+ "order_name": "#1024",
37
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/818d238ada8ae2d16c50329c3418e9b2/authenticate?key=a0f627404a756a235bf1e1604e2165c4"
38
+ },
39
+ {
40
+ "return_id": 9873981661,
41
+ "return_name": "#1018-R1",
42
+ "return_status": "OPEN",
43
+ "created_at": "2025-07-03T08:35:24Z",
44
+ "total_quantity": 1,
45
+ "order_name": "#1018",
46
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/73a405f0022f7c3b603ef5b48875af2f/authenticate?key=548224bed1be4909eb1aac9dd123f972"
47
+ },
48
+ {
49
+ "return_id": 9856876765,
50
+ "return_name": "#1017-R1",
51
+ "return_status": "CLOSED",
52
+ "created_at": "2025-07-02T08:54:44Z",
53
+ "total_quantity": 1,
54
+ "order_name": "#1017",
55
+ "order_url": "https://stage-qb24.myshopify.com/75575722205/orders/494711e122c429d92bcd838ddb7e5910/authenticate?key=7f2b36d5230d2799ed338a43fcb5696a"
56
+ }
57
+ ],
58
+ "success": true
59
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "order": {
3
+ "order_id": 6216346403037,
4
+ "manual": true,
5
+ "address": {
6
+ "firstName": "martina",
7
+ "lastName": "piangerelli",
8
+ "phone": null,
9
+ "address1": "Via IV Martiri",
10
+ "address2": null,
11
+ "zip": "36071",
12
+ "city": "Arzignano",
13
+ "provinceCode": "VI",
14
+ "countryCode": "IT"
15
+ },
16
+ "reasons": [
17
+ {
18
+ "id": "NOT_AS_DESCRIBED",
19
+ "description": "L'articolo non è quello ordinato"
20
+ },
21
+ {
22
+ "id": "DEFECTIVE",
23
+ "description": "L'articolo è fallato (ha difetti, fili tirati, è sporco ecc)"
24
+ },
25
+ {
26
+ "id": "OTHER",
27
+ "description": "Non è stato consegnato nei tempi previsti"
28
+ },
29
+ {
30
+ "id": "UNWANTED",
31
+ "description": "Non mi soddisfa"
32
+ },
33
+ {
34
+ "id": "SIZE_TOO_LARGE",
35
+ "description": "Articolo troppo grande"
36
+ },
37
+ {
38
+ "id": "SIZE_TOO_SMALL",
39
+ "description": "Articolo troppo piccolo"
40
+ },
41
+ {
42
+ "id": "NOT_AS_DESCRIBED",
43
+ "description": "Descrizione del prodotto non chiara"
44
+ },
45
+ {
46
+ "id": "STYLE",
47
+ "description": "La forma non rispetta quanto mostrato in foto"
48
+ },
49
+ {
50
+ "id": "UNKOWN",
51
+ "description": "Ordinato più prodotti per provare la taglia"
52
+ }
53
+ ],
54
+ "lines": [
55
+ {
56
+ "id": 12934471647453,
57
+ "title": "44",
58
+ "price": 0.0,
59
+ "quantity": 1,
60
+ "product_title": "Bermuda Uomo Slim-Fit Basic QB24",
61
+ "color": "Blu",
62
+ "image": "https://cdn.shopify.com/s/files/1/0755/7572/2205/files/3f36f5729aeafffd7d48a673fbd1b5078ab21b01_CFC0120541003B041_7a552d4b-a685-43ae-b716-ab8ed7ab0a48.jpg?v=1746018844"
63
+ }
64
+ ]
65
+ },
66
+ "success": true
67
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "order": {
3
+ "order_id": 6817023557959,
4
+ "manual": false,
5
+ "address": {
6
+ "firstName": "martina",
7
+ "lastName": "piangerelli",
8
+ "phone": "3205519009",
9
+ "address1": "Via A. Diaz 33",
10
+ "address2": null,
11
+ "zip": "36071",
12
+ "city": "Arzignano",
13
+ "provinceCode": "VI",
14
+ "countryCode": "IT"
15
+ },
16
+ "reasons": [
17
+ {
18
+ "id": "NOT_AS_DESCRIBED",
19
+ "description": "L'articolo non è quello ordinato"
20
+ },
21
+ {
22
+ "id": "DEFECTIVE",
23
+ "description": "L'articolo è fallato (ha difetti, fili tirati, è sporco ecc)"
24
+ },
25
+ {
26
+ "id": "OTHER",
27
+ "description": "Non è stato consegnato nei tempi previsti"
28
+ },
29
+ {
30
+ "id": "UNWANTED",
31
+ "description": "Non mi soddisfa"
32
+ },
33
+ {
34
+ "id": "SIZE_TOO_LARGE",
35
+ "description": "Articolo troppo grande"
36
+ },
37
+ {
38
+ "id": "SIZE_TOO_SMALL",
39
+ "description": "Articolo troppo piccolo"
40
+ },
41
+ {
42
+ "id": "NOT_AS_DESCRIBED",
43
+ "description": "Descrizione del prodotto non chiara"
44
+ },
45
+ {
46
+ "id": "STYLE",
47
+ "description": "La forma non rispetta quanto mostrato in foto"
48
+ },
49
+ {
50
+ "id": "UNKOWN",
51
+ "description": "Ordinato più prodotti per provare la taglia"
52
+ }
53
+ ],
54
+ "lines": [
55
+ {
56
+ "id": 15140195795271,
57
+ "title": "S",
58
+ "price": 85.0,
59
+ "quantity": 1,
60
+ "product_title": "Maglia Uomo Girocollo Lavorazione Collo QB24",
61
+ "color": "Grigio",
62
+ "image": "https://cdn.shopify.com/s/files/1/0880/3998/1383/files/7859c038c36512260843a14a8980c306756bcbe0_CFC0120918003B256.jpg?v=1753083474"
63
+ },
64
+ {
65
+ "id": 15140195828039,
66
+ "title": "XS",
67
+ "price": 99.0,
68
+ "quantity": 1,
69
+ "product_title": "Polo Uomo in Maglia Lavorazione Frontale QB24",
70
+ "color": "Nero",
71
+ "image": "https://cdn.shopify.com/s/files/1/0880/3998/1383/files/4298d35eefae6b66c55ddcbfac15dcbe5541dfc5_CFC0120917003B001.jpg?v=1753592501"
72
+ }
73
+ ]
74
+ },
75
+ "success": true
76
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "success": false,
3
+ "error": "Item not found in wishlist"
4
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "success": true
3
+ }
@@ -0,0 +1,55 @@
1
+ await loadComponent('./wishlist/teddy-wishlist.js', false);
2
+ await loadComponent('./components/mc-element.js', false);
3
+
4
+ class TeddyWishlistBtn extends McElement {
5
+
6
+
7
+ connectedCallback() {
8
+ if (!this.dataset.variant || !this.dataset.handle) { console.error('TeddyWishlistBtn: missing data-variant or data-handle'); return; }
9
+
10
+ this.addEventListener('click', (e) => {
11
+ e.preventDefault();
12
+ e.stopPropagation();
13
+ this.toggle();
14
+ });
15
+ this.setState();
16
+ }
17
+
18
+ toggle = () => {
19
+ if (TeddyWishlist.isInWishlist(this.getItem())) {
20
+ this.remove();
21
+ } else {
22
+ this.add();
23
+ }
24
+ }
25
+
26
+ getItem = () => {
27
+ return {
28
+ variant: this.dataset.variant,
29
+ handle: this.dataset.handle,
30
+ };
31
+ }
32
+
33
+ add = () => {
34
+ TeddyWishlist.addItem(this.getItem());
35
+ this.setState();
36
+ }
37
+
38
+ remove = () => {
39
+ TeddyWishlist.removeItem(this.getItem());
40
+ this.setState();
41
+ }
42
+
43
+ setState = () => {
44
+ if (TeddyWishlist.isInWishlist(this.getItem())) {
45
+ this.classList.add('active');
46
+ } else {
47
+ this.classList.remove('active');
48
+ }
49
+ }
50
+
51
+ }
52
+ if (!window.customElements.get('teddy-wishlist-btn')) {
53
+ window.customElements.define('teddy-wishlist-btn', TeddyWishlistBtn);
54
+ }
55
+ window.TeddyWishlistBtn = TeddyWishlistBtn;
@@ -0,0 +1,18 @@
1
+ await loadComponent('./wishlist/teddy-wishlist.js', false);
2
+ await loadComponent('./components/mc-element.js', false);
3
+
4
+ class TeddyWishlistClear extends McElement {
5
+
6
+ connectedCallback() {
7
+ this.addEventListener('click', this.clear.bind(this));
8
+ }
9
+
10
+ clear = () => {
11
+ TeddyWishlist.clearWishlist();
12
+ }
13
+
14
+ }
15
+ if (!window.customElements.get('teddy-wishlist-clear')) {
16
+ window.customElements.define('teddy-wishlist-clear', TeddyWishlistClear);
17
+ }
18
+ window.TeddyWishlistClear = TeddyWishlistClear;
@@ -0,0 +1,35 @@
1
+ import '../res/mc-events.js';
2
+ await loadComponent('./wishlist/teddy-wishlist.js', false);
3
+ await loadComponent('./components/mc-element.js', false);
4
+
5
+ class TeddyWishlistCounter extends McElement {
6
+
7
+ connectedCallback() {
8
+ // all'evento change della wishlist aggiorna il counter
9
+ this.updateCounter();
10
+ window.addEventListener(MCEVENTS.WISHLIST_CHANGED, (e) => {
11
+ this.updateCounter();
12
+ });
13
+ }
14
+
15
+ updateCounter() {
16
+ // aggiorna il counter
17
+ const template = this.querySelector('template');
18
+ const container = this.querySelector('[data-counter]');
19
+ if (!template) { console.error('TeddyWishlistCounter: template not found'); return; }
20
+ if (!container) { console.error('TeddyWishlistCounter: counter container not found'); return; }
21
+
22
+ const count = TeddyWishlist.getItemCount();
23
+ console.log('TeddyWishlistCounter: updating counter', count);
24
+ if (count > 0) {
25
+ container.innerHTML = template.innerHTML.replace('${count}', count);
26
+ } else {
27
+ container.innerHTML = '';
28
+ }
29
+ }
30
+
31
+ }
32
+ if (!window.customElements.get('teddy-wishlist-counter')) {
33
+ window.customElements.define('teddy-wishlist-counter', TeddyWishlistCounter);
34
+ }
35
+ window.TeddyWishlistCounter = TeddyWishlistCounter;