@evenicanpm/storefront-core 2.3.0 → 2.4.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +29 -9
  3. package/src/api-manager/datasources/d365/d365-address.datasource.ts +11 -0
  4. package/src/api-manager/datasources/d365/d365-cart.datasource.ts +23 -1
  5. package/src/api-manager/datasources/d365/d365-order.datasource.ts +6 -1
  6. package/src/api-manager/datasources/d365/d365-user.datasource.ts +29 -14
  7. package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +7 -0
  8. package/src/api-manager/index.ts +2 -1
  9. package/src/api-manager/schemas/product.schema.ts +1 -1
  10. package/src/auth/msal.ts +1 -4
  11. package/src/cms/blocks/block-manager.tsx +1 -1
  12. package/src/cms/blocks/components/footer/footer-content.tsx +61 -0
  13. package/src/cms/blocks/components/footer/index.tsx +9 -71
  14. package/src/cms/blocks/components/footer/interfaces.ts +4 -0
  15. package/src/cms/blocks/components/footer/sections/footer-contact.tsx +18 -9
  16. package/src/cms/blocks/components/footer/sections/footer-logo.tsx +17 -2
  17. package/src/cms/endpoints.ts +7 -2
  18. package/src/components/BazaarMenu.tsx +1 -1
  19. package/src/components/Typography.tsx +4 -2
  20. package/src/components/_tests_/site-logo.test.tsx +1 -1
  21. package/src/components/carousel-cards/carousel-card-1/CarouselCard1.stories.tsx +1 -1
  22. package/src/components/categories/category-menu.tsx +1 -1
  23. package/src/components/countries-input.tsx +4 -0
  24. package/src/components/header/components/user.tsx +4 -5
  25. package/src/components/navbar/mobile-menu/mobile-menu.test.tsx +1 -1
  26. package/src/components/navbar/utils/transform-nav.test.ts +1 -1
  27. package/src/components/navbar/utils/transform-nav.ts +1 -1
  28. package/src/components/product-cards/product-card/product-card.tsx +5 -2
  29. package/src/components/product-cards/product-card/styles/index.ts +1 -5
  30. package/src/components/product-cards/product-card-plp/product-card.tsx +4 -12
  31. package/src/components/product-cards/product-card-plp/styles/index.ts +15 -0
  32. package/src/components/products-view/compound/products-grid-view.tsx +5 -1
  33. package/src/components/products-view/compound/products-list-view.tsx +5 -1
  34. package/src/components/site-logo.tsx +1 -1
  35. package/src/components/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +3 -1
  36. package/src/global.d.ts +3 -0
  37. package/src/pages/account/account-navigation.tsx +2 -2
  38. package/src/pages/account/account-routes.ts +38 -4
  39. package/src/pages/account/addresses/address-form.tsx +20 -2
  40. package/src/pages/account/table-row-skeleton.tsx +31 -0
  41. package/src/pages/account/wishlist/wishlist-item.tsx +3 -1
  42. package/src/pages/blog/blog-detail-view.tsx +3 -1
  43. package/src/pages/cart/cart-item.tsx +1 -7
  44. package/src/pages/checkout/checkout-alt-form/checkout-form.tsx +14 -3
  45. package/src/pages/checkout/checkout-alt-form/steps/address/address-card.tsx +5 -3
  46. package/src/pages/checkout/checkout-alt-form/steps/address/new-address-form.tsx +1 -1
  47. package/src/pages/cms-page-view.tsx +1 -1
  48. package/src/pages/confirmation/ordered-products.tsx +3 -1
  49. package/src/pages/product-details/bopis/find-in-store-modal.tsx +4 -4
  50. package/src/pages/product-details/bopis/pickup-option-select.tsx +2 -2
  51. package/src/pages/product-details/bopis/search-header.tsx +2 -2
  52. package/src/pages/product-details/product-description.tsx +25 -13
  53. package/src/pages/product-details/product-intro/compound/context.ts +8 -3
  54. package/src/pages/product-details/product-intro/compound/product-info.tsx +25 -19
  55. package/src/pages/product-details/product-intro/compound/product-intro-images.tsx +26 -8
  56. package/src/pages/product-details/product-intro/compound/thumbnail-with-skeleton.tsx +17 -21
  57. package/src/pages/product-details/product-tabs.tsx +20 -4
  58. package/src/pages/product-list/product-list-view.tsx +2 -1
  59. package/src/providers/nav-provider/index.tsx +1 -1
  60. package/src/providers/nav-provider/utils/createLink.ts +1 -1
  61. package/tsconfig.json +1 -2
  62. package/__mocks__/countries.ts +0 -11
  63. package/__mocks__/create-mutation.ts +0 -68
  64. package/__mocks__/create-query.ts +0 -94
  65. package/__mocks__/data/categories.json +0 -795
  66. package/__mocks__/get-product-by-id.ts +0 -6
  67. package/__mocks__/next-auth-react.ts +0 -9
  68. package/__mocks__/next-font.js +0 -4
  69. package/__mocks__/next-headers.js +0 -13
  70. package/__mocks__/next-image.tsx +0 -18
  71. package/__mocks__/next-link.js +0 -19
  72. package/__mocks__/next-navigation.ts +0 -29
  73. package/__mocks__/product-dimensions.ts +0 -635
  74. package/__mocks__/products.ts +0 -533
  75. package/__mocks__/query-client.ts +0 -3
  76. package/__mocks__/wishlists.json +0 -408
  77. package/src/cms/blog.ts +0 -229
  78. package/src/cms/interfaces/navigation.ts +0 -52
  79. package/src/cms/interfaces/product-data.ts +0 -83
  80. package/src/cms/pages.ts +0 -149
@@ -1,408 +0,0 @@
1
- [
2
- {
3
- "Id": "RVY7BDT1T0PW",
4
- "Name": "this is a test",
5
- "CustomerId": "005221",
6
- "LastUpdated": "2025-08-19T20:33:10.527Z",
7
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
8
- "ProductListTypeValue": 3,
9
- "DataAreaId": "usrt",
10
- "ChannelId": 68719478279,
11
- "ProductListLines": [
12
- {
13
- "ProductListId": "RVY7BDT1T0PW",
14
- "LineId": "0CGM02C7C1NB",
15
- "ProductId": 68719493424,
16
- "Quantity": 2,
17
- "UnitOfMeasure": "ea",
18
- "LastUpdated": "2025-09-22T16:11:19.320Z",
19
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
20
- "DataAreaId": "usrt",
21
- "CatalogId": 0,
22
- "ExtensionProperties": []
23
- },
24
- {
25
- "ProductListId": "RVY7BDT1T0PW",
26
- "LineId": "QV9HA6AK6YVY",
27
- "ProductId": 0,
28
- "Quantity": 1,
29
- "UnitOfMeasure": "ea",
30
- "LastUpdated": "2025-09-22T16:11:19.320Z",
31
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
32
- "DataAreaId": "usrt",
33
- "CatalogId": 0,
34
- "ExtensionProperties": []
35
- }
36
- ],
37
- "ExtensionProperties": []
38
- },
39
- {
40
- "Id": "VFJD2RWKDGZC",
41
- "Name": "new list 55555",
42
- "CustomerId": "005221",
43
- "LastUpdated": "2025-08-19T17:34:05.863Z",
44
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
45
- "ProductListTypeValue": 3,
46
- "DataAreaId": "usrt",
47
- "ChannelId": 68719478279,
48
- "ProductListLines": [
49
- {
50
- "ProductListId": "VFJD2RWKDGZC",
51
- "LineId": "4BMTW9T0C7GQ",
52
- "ProductId": 68719493424,
53
- "Quantity": 1,
54
- "UnitOfMeasure": "ea",
55
- "LastUpdated": "2025-09-22T16:10:09.403Z",
56
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
57
- "DataAreaId": "usrt",
58
- "CatalogId": 0,
59
- "ExtensionProperties": []
60
- },
61
- {
62
- "ProductListId": "VFJD2RWKDGZC",
63
- "LineId": "56W0Q72JXS24",
64
- "ProductId": 68719493343,
65
- "Quantity": 1,
66
- "UnitOfMeasure": "ea",
67
- "LastUpdated": "2025-08-22T17:28:48.490Z",
68
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
69
- "DataAreaId": "usrt",
70
- "CatalogId": 0,
71
- "ExtensionProperties": []
72
- },
73
- {
74
- "ProductListId": "VFJD2RWKDGZC",
75
- "LineId": "9S22MCTF4RF2",
76
- "ProductId": 68719494740,
77
- "Quantity": 1,
78
- "UnitOfMeasure": "ea",
79
- "LastUpdated": "2025-08-21T14:13:58.090Z",
80
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
81
- "DataAreaId": "usrt",
82
- "CatalogId": 0,
83
- "ExtensionProperties": []
84
- },
85
- {
86
- "ProductListId": "VFJD2RWKDGZC",
87
- "LineId": "HFXTTYRFW702",
88
- "ProductId": 68719492346,
89
- "Quantity": 1,
90
- "UnitOfMeasure": "ea",
91
- "LastUpdated": "2025-08-21T21:20:02.277Z",
92
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
93
- "DataAreaId": "usrt",
94
- "CatalogId": 0,
95
- "ExtensionProperties": []
96
- },
97
- {
98
- "ProductListId": "VFJD2RWKDGZC",
99
- "LineId": "XZFDNDJRPH17",
100
- "ProductId": 0,
101
- "Quantity": 1,
102
- "UnitOfMeasure": "ea",
103
- "LastUpdated": "2025-09-04T14:16:13.533Z",
104
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
105
- "DataAreaId": "usrt",
106
- "CatalogId": 0,
107
- "ExtensionProperties": []
108
- }
109
- ],
110
- "ExtensionProperties": []
111
- },
112
- {
113
- "Id": "GTXHBWXF4F7R",
114
- "Name": "test 3",
115
- "CustomerId": "005221",
116
- "LastUpdated": "2025-08-19T17:07:00.050Z",
117
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
118
- "ProductListTypeValue": 3,
119
- "DataAreaId": "usrt",
120
- "ChannelId": 68719478279,
121
- "ProductListLines": [
122
- {
123
- "ProductListId": "GTXHBWXF4F7R",
124
- "LineId": "4045Q11RE7WK",
125
- "ProductId": 68719493343,
126
- "Quantity": 1,
127
- "UnitOfMeasure": "ea",
128
- "LastUpdated": "2025-08-22T17:28:48.650Z",
129
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
130
- "DataAreaId": "usrt",
131
- "CatalogId": 0,
132
- "ExtensionProperties": []
133
- },
134
- {
135
- "ProductListId": "GTXHBWXF4F7R",
136
- "LineId": "JSG7K4Q3XVTR",
137
- "ProductId": 0,
138
- "Quantity": 1,
139
- "UnitOfMeasure": "ea",
140
- "LastUpdated": "2025-09-04T14:16:16.300Z",
141
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
142
- "DataAreaId": "usrt",
143
- "CatalogId": 0,
144
- "ExtensionProperties": []
145
- },
146
- {
147
- "ProductListId": "GTXHBWXF4F7R",
148
- "LineId": "VRZB69D7XGNM",
149
- "ProductId": 68719492346,
150
- "Quantity": 1,
151
- "UnitOfMeasure": "ea",
152
- "LastUpdated": "2025-08-21T21:20:03.023Z",
153
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
154
- "DataAreaId": "usrt",
155
- "CatalogId": 0,
156
- "ExtensionProperties": []
157
- }
158
- ],
159
- "ExtensionProperties": []
160
- },
161
- {
162
- "Id": "TFV4YMV7RJN6",
163
- "Name": "test1",
164
- "CustomerId": "005221",
165
- "LastUpdated": "2025-08-19T17:03:57.543Z",
166
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
167
- "ProductListTypeValue": 3,
168
- "DataAreaId": "usrt",
169
- "ChannelId": 68719478279,
170
- "ProductListLines": [
171
- {
172
- "ProductListId": "TFV4YMV7RJN6",
173
- "LineId": "7DY1GBH7YXYW",
174
- "ProductId": 68719493343,
175
- "Quantity": 1,
176
- "UnitOfMeasure": "ea",
177
- "LastUpdated": "2025-08-22T17:28:52.497Z",
178
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
179
- "DataAreaId": "usrt",
180
- "CatalogId": 0,
181
- "ExtensionProperties": []
182
- },
183
- {
184
- "ProductListId": "TFV4YMV7RJN6",
185
- "LineId": "G4EG7YEF5RYE",
186
- "ProductId": 68719491411,
187
- "Quantity": 1,
188
- "UnitOfMeasure": "ea",
189
- "LastUpdated": "2025-08-20T20:46:23.860Z",
190
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
191
- "DataAreaId": "usrt",
192
- "CatalogId": 0,
193
- "ExtensionProperties": []
194
- },
195
- {
196
- "ProductListId": "TFV4YMV7RJN6",
197
- "LineId": "NDB9A21E3PDD",
198
- "ProductId": 68719494740,
199
- "Quantity": 1,
200
- "UnitOfMeasure": "ea",
201
- "LastUpdated": "2025-08-21T14:14:21.577Z",
202
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
203
- "DataAreaId": "usrt",
204
- "CatalogId": 0,
205
- "ExtensionProperties": []
206
- }
207
- ],
208
- "ExtensionProperties": []
209
- },
210
- {
211
- "Id": "NKQNFR6W0TBK",
212
- "Name": "test1",
213
- "CustomerId": "005221",
214
- "LastUpdated": "2025-08-19T17:03:57.320Z",
215
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
216
- "ProductListTypeValue": 3,
217
- "DataAreaId": "usrt",
218
- "ChannelId": 68719478279,
219
- "ProductListLines": [
220
- {
221
- "ProductListId": "NKQNFR6W0TBK",
222
- "LineId": "XTNKG98E3SN4",
223
- "ProductId": 68719493343,
224
- "Quantity": 1,
225
- "UnitOfMeasure": "ea",
226
- "LastUpdated": "2025-08-22T17:28:52.137Z",
227
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
228
- "DataAreaId": "usrt",
229
- "CatalogId": 0,
230
- "ExtensionProperties": []
231
- }
232
- ],
233
- "ExtensionProperties": []
234
- },
235
- {
236
- "Id": "DQ7SDV6Q56W4",
237
- "Name": "aaaaaaaaaaaaaaa",
238
- "CustomerId": "005221",
239
- "LastUpdated": "2025-08-19T17:03:28.500Z",
240
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
241
- "ProductListTypeValue": 3,
242
- "DataAreaId": "usrt",
243
- "ChannelId": 68719478279,
244
- "ProductListLines": [
245
- {
246
- "ProductListId": "DQ7SDV6Q56W4",
247
- "LineId": "2J7BQPK41FZ6",
248
- "ProductId": 68719494825,
249
- "Quantity": 1,
250
- "UnitOfMeasure": "ea",
251
- "LastUpdated": "2025-08-21T14:12:50.247Z",
252
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
253
- "DataAreaId": "usrt",
254
- "CatalogId": 0,
255
- "ExtensionProperties": []
256
- },
257
- {
258
- "ProductListId": "DQ7SDV6Q56W4",
259
- "LineId": "E2QAAY1TMHJ6",
260
- "ProductId": 68719493343,
261
- "Quantity": 1,
262
- "UnitOfMeasure": "ea",
263
- "LastUpdated": "2025-08-22T17:28:51.767Z",
264
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
265
- "DataAreaId": "usrt",
266
- "CatalogId": 0,
267
- "ExtensionProperties": []
268
- },
269
- {
270
- "ProductListId": "DQ7SDV6Q56W4",
271
- "LineId": "T6342R3CNMSS",
272
- "ProductId": 68719494740,
273
- "Quantity": 1,
274
- "UnitOfMeasure": "ea",
275
- "LastUpdated": "2025-08-21T14:13:59.213Z",
276
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
277
- "DataAreaId": "usrt",
278
- "CatalogId": 0,
279
- "ExtensionProperties": []
280
- }
281
- ],
282
- "ExtensionProperties": []
283
- },
284
- {
285
- "Id": "DCZCEJZE01QR",
286
- "Name": "asdfasd",
287
- "CustomerId": "005221",
288
- "LastUpdated": "2025-08-19T16:56:55.030Z",
289
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
290
- "ProductListTypeValue": 3,
291
- "DataAreaId": "usrt",
292
- "ChannelId": 68719478279,
293
- "ProductListLines": [
294
- {
295
- "ProductListId": "DCZCEJZE01QR",
296
- "LineId": "BT2DFV8DPRQY",
297
- "ProductId": 68719493343,
298
- "Quantity": 1,
299
- "UnitOfMeasure": "ea",
300
- "LastUpdated": "2025-08-22T17:28:50.393Z",
301
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
302
- "DataAreaId": "usrt",
303
- "CatalogId": 0,
304
- "ExtensionProperties": []
305
- },
306
- {
307
- "ProductListId": "DCZCEJZE01QR",
308
- "LineId": "SKPETR0EP8CC",
309
- "ProductId": 68719494825,
310
- "Quantity": 1,
311
- "UnitOfMeasure": "ea",
312
- "LastUpdated": "2025-08-21T14:12:50.717Z",
313
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
314
- "DataAreaId": "usrt",
315
- "CatalogId": 0,
316
- "ExtensionProperties": []
317
- }
318
- ],
319
- "ExtensionProperties": []
320
- },
321
- {
322
- "Id": "2PMAXR3M8514",
323
- "Name": "asdfasd",
324
- "CustomerId": "005221",
325
- "LastUpdated": "2025-08-19T16:56:55.030Z",
326
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
327
- "ProductListTypeValue": 3,
328
- "DataAreaId": "usrt",
329
- "ChannelId": 68719478279,
330
- "ProductListLines": [
331
- {
332
- "ProductListId": "2PMAXR3M8514",
333
- "LineId": "HFCKX9WMXEJ9",
334
- "ProductId": 68719493343,
335
- "Quantity": 1,
336
- "UnitOfMeasure": "ea",
337
- "LastUpdated": "2025-08-22T17:28:50.560Z",
338
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
339
- "DataAreaId": "usrt",
340
- "CatalogId": 0,
341
- "ExtensionProperties": []
342
- }
343
- ],
344
- "ExtensionProperties": []
345
- },
346
- {
347
- "Id": "JSPE9DPVDJN0",
348
- "Name": "hi",
349
- "CustomerId": "005221",
350
- "LastUpdated": "2025-08-18T21:35:59.757Z",
351
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
352
- "ProductListTypeValue": 3,
353
- "DataAreaId": "usrt",
354
- "ChannelId": 68719478279,
355
- "ProductListLines": [
356
- {
357
- "ProductListId": "JSPE9DPVDJN0",
358
- "LineId": "EDHM62HHYWS5",
359
- "ProductId": 68719493343,
360
- "Quantity": 1,
361
- "UnitOfMeasure": "ea",
362
- "LastUpdated": "2025-08-22T17:28:50.923Z",
363
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
364
- "DataAreaId": "usrt",
365
- "CatalogId": 0,
366
- "ExtensionProperties": []
367
- }
368
- ],
369
- "ExtensionProperties": []
370
- },
371
- {
372
- "Id": "Y9E16F4RHS3C",
373
- "Name": "April 25th",
374
- "CustomerId": "005221",
375
- "LastUpdated": "2025-05-02T15:36:51.750Z",
376
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
377
- "ProductListTypeValue": 3,
378
- "DataAreaId": "usrt",
379
- "ChannelId": 68719478279,
380
- "ProductListLines": [
381
- {
382
- "ProductListId": "Y9E16F4RHS3C",
383
- "LineId": "XSEXJDCPVCZ5",
384
- "ProductId": 68719494825,
385
- "Quantity": 1,
386
- "UnitOfMeasure": "ea",
387
- "LastUpdated": "2025-08-19T15:00:26.650Z",
388
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
389
- "DataAreaId": "usrt",
390
- "CatalogId": 0,
391
- "ExtensionProperties": []
392
- }
393
- ],
394
- "ExtensionProperties": []
395
- },
396
- {
397
- "Id": "3HDWS752T6JW",
398
- "Name": "April 28th",
399
- "CustomerId": "005221",
400
- "LastUpdated": "2025-04-28T19:25:51.807Z",
401
- "DeletedDateTime": "1900-01-01T00:00:00.000Z",
402
- "ProductListTypeValue": 3,
403
- "DataAreaId": "usrt",
404
- "ChannelId": 68719478279,
405
- "ProductListLines": [],
406
- "ExtensionProperties": []
407
- }
408
- ]
package/src/cms/blog.ts DELETED
@@ -1,229 +0,0 @@
1
- import type { BlocksContent } from "@strapi/blocks-react-renderer";
2
- import cms from "@/cms/endpoints";
3
- import type { Formats } from "@/cms/interfaces/product-data";
4
-
5
- export interface Blogs {
6
- data: Array<{
7
- id: number;
8
- title: string;
9
- content: BlocksContent;
10
- image: {
11
- id: number;
12
- url: string;
13
- alternativeText: string;
14
- caption: string;
15
- formats: {
16
- large: {
17
- url: string;
18
- };
19
- thumbnail: {
20
- url: string;
21
- };
22
- };
23
- };
24
- createdAt: string;
25
- updatedAt: string;
26
- publishedAt: string;
27
- }>;
28
- meta: {
29
- pagination: {
30
- page: number;
31
- pageSize: number;
32
- pageCount: number;
33
- total: number;
34
- };
35
- };
36
- }
37
-
38
- export interface TransformedBlogs {
39
- __typename: string;
40
- recordCount: number;
41
- pageInfo: {
42
- __typename: string;
43
- top: number;
44
- skip: number;
45
- sort: string;
46
- sortDesc: boolean;
47
- search: string;
48
- };
49
- nodes: Array<{
50
- __typename: string;
51
- id: string;
52
- title: string;
53
- content: BlocksContent;
54
- image: {
55
- id: number;
56
- url: string;
57
- alternativeText: string;
58
- caption: string;
59
- formats: {
60
- large: {
61
- url: string;
62
- };
63
- thumbnail: {
64
- url: string;
65
- };
66
- };
67
- };
68
- modified: string;
69
- modifiedBy: null;
70
- created: string;
71
- }>;
72
- }
73
-
74
- export const transformBlogs = (strapiResponse: Blogs): TransformedBlogs => {
75
- const { data, meta } = strapiResponse;
76
-
77
- const nodes = data.map((item) => ({
78
- __typename: "Blog",
79
- id: item.id.toString(),
80
- title: item.title,
81
- content: item.content,
82
- image: {
83
- id: item.image.id,
84
- url: item.image.url,
85
- alternativeText: item.image.alternativeText,
86
- caption: item.image.caption,
87
- formats: item.image.formats,
88
- },
89
- modified: item.updatedAt,
90
- modifiedBy: null,
91
- created: item.createdAt,
92
- }));
93
-
94
- return {
95
- __typename: "BlogConnection",
96
- recordCount: meta.pagination.total,
97
- pageInfo: {
98
- __typename: "PageInfo",
99
- top: 50,
100
- skip: 0,
101
- sort: "modified",
102
- sortDesc: false,
103
- search: "",
104
- },
105
- nodes: nodes,
106
- };
107
- };
108
-
109
- export interface Blog {
110
- data: {
111
- id: number;
112
- title: string;
113
- content: BlocksContent;
114
- image: {
115
- id: number;
116
- url: string;
117
- alternativeText: string;
118
- caption: string;
119
- formats: {
120
- large: {
121
- url: string;
122
- };
123
- thumbnail: {
124
- url: string;
125
- };
126
- };
127
- };
128
- createdAt: string;
129
- updatedAt: string;
130
- publishedAt: string;
131
- };
132
- meta: {
133
- pagination: {
134
- total: number;
135
- };
136
- };
137
- }
138
-
139
- export interface TransformedBlog {
140
- __typename: string;
141
- recordCount: number;
142
- pageInfo: {
143
- __typename: string;
144
- top: number;
145
- skip: number;
146
- sort: string;
147
- sortDesc: boolean;
148
- search: string;
149
- };
150
- id: string;
151
- title: string;
152
- content: BlocksContent;
153
- image: {
154
- id: number;
155
- url: string;
156
- alternativeText: string;
157
- caption: string;
158
- formats: {
159
- large: {
160
- url: string;
161
- };
162
- thumbnail: {
163
- url: string;
164
- };
165
- };
166
- };
167
- created: string;
168
- }
169
-
170
- export const transformBlog = (response: Blog): TransformedBlog => {
171
- const { data, meta } = response;
172
- return {
173
- __typename: "Blog",
174
- recordCount: meta.pagination.total,
175
- pageInfo: {
176
- __typename: "PageInfo",
177
- top: 50,
178
- skip: 0,
179
- sort: "modified",
180
- sortDesc: false,
181
- search: "",
182
- },
183
- id: data.id.toString(),
184
- title: data.title,
185
- content: data.content,
186
- image: {
187
- id: data.image.id,
188
- url: data.image.url,
189
- alternativeText: data.image.alternativeText,
190
- caption: data.image.caption,
191
- formats: data.image.formats,
192
- },
193
- created: data.createdAt,
194
- };
195
- };
196
-
197
- export interface BlogData {
198
- title: string;
199
- id: number;
200
- content: BlocksContent;
201
- image: {
202
- id: number;
203
- url: string;
204
- alternativeText: string;
205
- caption: string;
206
- formats: Formats;
207
- };
208
- }
209
-
210
- export const createBlog = async (blogData: BlogData) => {
211
- try {
212
- const response = await fetch(cms.getCmsApiUrl("blogs"), {
213
- method: "POST",
214
- headers: { "Content-Type": "application/json" },
215
- body: JSON.stringify({
216
- data: blogData,
217
- }),
218
- });
219
-
220
- if (!response.ok) {
221
- throw new Error(`HTTP error! Status: ${response.status}`);
222
- }
223
-
224
- return await response.json();
225
- } catch (error) {
226
- console.error("Error creating blog:", error);
227
- throw error;
228
- }
229
- };
@@ -1,52 +0,0 @@
1
- // cms internal interfaces
2
- export interface CmsNavigation {
3
- nodes: {
4
- name: string;
5
- id: number;
6
- items: (CmsPage | CmsSubMenu)[];
7
- }[];
8
- }
9
-
10
- export interface CmsPage {
11
- type: string;
12
- id: number;
13
- name: string;
14
- slug: string;
15
- }
16
-
17
- export interface CmsSubMenu {
18
- type: string;
19
- name: string;
20
- pages: CmsPage[];
21
- }
22
-
23
- export interface CmsNavRelated {
24
- id: number;
25
- title: string;
26
- slug: string;
27
- createdAt: string;
28
- updatedAt: string;
29
- publishedAt?: string | null;
30
-
31
- /** Optional content‑type hint Strapi adds when `populate=*` */
32
- __contentType?: string;
33
-
34
- /**
35
- * Any other attributes your model exposes (e.g., SEO fields,
36
- * coverImage, etc.). Keep this open so the type stays valid
37
- * if the Strapi model grows.
38
- */
39
- [key: string]: unknown;
40
- }
41
-
42
- export interface CmsNavItem {
43
- title: string;
44
- menuAttached: boolean;
45
- path: string;
46
- type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
47
- uiRouterKey: string;
48
- slug: string;
49
- related: CmsNavRelated | null;
50
- external: boolean;
51
- items: CmsNavItem[];
52
- }