@evenicanpm/storefront-core 2.3.1 → 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 (59) 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/index.ts +2 -1
  7. package/src/api-manager/schemas/product.schema.ts +1 -1
  8. package/src/auth/msal.ts +1 -4
  9. package/src/cms/blocks/block-manager.tsx +1 -1
  10. package/src/cms/endpoints.ts +7 -2
  11. package/src/components/BazaarMenu.tsx +1 -1
  12. package/src/components/Typography.tsx +4 -2
  13. package/src/components/carousel-cards/carousel-card-1/CarouselCard1.stories.tsx +1 -1
  14. package/src/components/categories/category-menu.tsx +1 -1
  15. package/src/components/countries-input.tsx +4 -0
  16. package/src/components/header/sticky-header.tsx +0 -1
  17. package/src/components/navbar/mobile-menu/mobile-menu.test.tsx +1 -1
  18. package/src/components/navbar/utils/transform-nav.test.ts +1 -1
  19. package/src/components/navbar/utils/transform-nav.ts +1 -1
  20. package/src/components/product-cards/product-card/product-card.tsx +5 -2
  21. package/src/components/product-cards/product-card/styles/index.ts +1 -5
  22. package/src/components/products-view/compound/products-grid-view.tsx +5 -1
  23. package/src/components/products-view/compound/products-list-view.tsx +5 -1
  24. package/src/global.d.ts +3 -0
  25. package/src/pages/account/addresses/address-form.tsx +20 -2
  26. package/src/pages/account/wishlist/wishlist-item.tsx +1 -2
  27. package/src/pages/cart/cart-item.tsx +1 -7
  28. package/src/pages/checkout/checkout-alt-form/checkout-form.tsx +14 -3
  29. package/src/pages/checkout/checkout-alt-form/steps/address/address-card.tsx +5 -3
  30. package/src/pages/checkout/checkout-alt-form/steps/address/new-address-form.tsx +1 -1
  31. package/src/pages/confirmation/ordered-products.tsx +3 -1
  32. package/src/pages/product-details/bopis/find-in-store-modal.tsx +4 -4
  33. package/src/pages/product-details/bopis/pickup-option-select.tsx +2 -2
  34. package/src/pages/product-details/bopis/search-header.tsx +2 -2
  35. package/src/pages/product-details/product-intro/compound/context.ts +8 -3
  36. package/src/pages/product-details/product-intro/compound/product-info.tsx +25 -19
  37. package/src/pages/product-list/product-list-view.tsx +2 -1
  38. package/src/providers/nav-provider/index.tsx +1 -1
  39. package/src/providers/nav-provider/utils/createLink.ts +1 -1
  40. package/tsconfig.json +1 -2
  41. package/__mocks__/countries.ts +0 -11
  42. package/__mocks__/create-mutation.ts +0 -68
  43. package/__mocks__/create-query.ts +0 -94
  44. package/__mocks__/data/categories.json +0 -795
  45. package/__mocks__/get-product-by-id.ts +0 -6
  46. package/__mocks__/next-auth-react.ts +0 -9
  47. package/__mocks__/next-font.js +0 -4
  48. package/__mocks__/next-headers.js +0 -13
  49. package/__mocks__/next-image.tsx +0 -18
  50. package/__mocks__/next-link.js +0 -19
  51. package/__mocks__/next-navigation.ts +0 -29
  52. package/__mocks__/product-dimensions.ts +0 -635
  53. package/__mocks__/products.ts +0 -533
  54. package/__mocks__/query-client.ts +0 -3
  55. package/__mocks__/wishlists.json +0 -408
  56. package/src/cms/blog.ts +0 -229
  57. package/src/cms/interfaces/navigation.ts +0 -52
  58. package/src/cms/interfaces/product-data.ts +0 -83
  59. package/src/cms/pages.ts +0 -149
@@ -1,83 +0,0 @@
1
- export interface ProductData {
2
- data: Array<{
3
- id: number;
4
- name: string;
5
- description: string;
6
- sku: string;
7
- createdAt: string;
8
- keywords: string;
9
- updatedAt: string;
10
- publishedAt: string;
11
- image: ProductImage[];
12
- }>;
13
- meta: {
14
- pagination: {
15
- page: number;
16
- pageSize: number;
17
- pageCount: number;
18
- total: number;
19
- };
20
- };
21
- }
22
-
23
- export interface ProductImage {
24
- id: number;
25
- name: string;
26
- alternativeText: string | null;
27
- caption: string | null;
28
- width: number;
29
- height: number;
30
- url: string;
31
- ext: string;
32
- mime: string;
33
- size: number;
34
- hash: string;
35
- provider: string;
36
- provider_metadata: Record<string, unknown> | null;
37
- previewUrl: string | null;
38
- createdAt: string;
39
- updatedAt: string;
40
- formats?: Formats;
41
- }
42
-
43
- export interface ImageFormat {
44
- ext: string;
45
- url: string;
46
- hash: string;
47
- mime: string;
48
- name: string;
49
- path: string | null;
50
- size: number;
51
- width: number;
52
- height: number;
53
- }
54
-
55
- export interface Formats {
56
- /** Strapi generates only the sizes you configure.
57
- Keep this flexible by using an index signature. */
58
- [size: string]: ImageFormat;
59
- }
60
-
61
- interface ImageAttributes {
62
- name: string;
63
- alternativeText: string | null;
64
- caption: string | null;
65
- width: number;
66
- height: number;
67
- formats: Formats;
68
- hash: string;
69
- ext: string;
70
- mime: string;
71
- size: number;
72
- url: string;
73
- previewUrl: string | null;
74
- provider: string;
75
- provider_metadata: Record<string, unknown> | null;
76
- createdAt: string;
77
- updatedAt: string;
78
- }
79
-
80
- export interface ImageData {
81
- id: number;
82
- attributes: ImageAttributes;
83
- }
package/src/cms/pages.ts DELETED
@@ -1,149 +0,0 @@
1
- import cmsEndPoints from "@/cms/endpoints";
2
-
3
- // TODO -> No types should be in CMS folder -> setup strapi codegen
4
- export interface Pages {
5
- data: Array<{
6
- id: number;
7
- attributes: {
8
- title: string;
9
- slug: string;
10
- content: string;
11
- isBlog: boolean;
12
- createdAt: string;
13
- updatedAt: string;
14
- publishedAt: string;
15
- };
16
- }>;
17
- meta: {
18
- pagination: {
19
- page: number;
20
- pageSize: number;
21
- pageCount: number;
22
- total: number;
23
- };
24
- };
25
- }
26
-
27
- export interface TransformedPages {
28
- __typename: string;
29
- recordCount: number;
30
- pageInfo: {
31
- __typename: string;
32
- top: number;
33
- skip: number;
34
- sort: string;
35
- sortDesc: boolean;
36
- search: string;
37
- };
38
- nodes: Array<{
39
- __typename: string;
40
- id: string;
41
- title: string;
42
- slug: string;
43
- content: string;
44
- isBlog: boolean;
45
- modified: string;
46
- modifiedBy: null;
47
- created: string;
48
- }>;
49
- }
50
-
51
- export const transformPages = (strapiResponse: Pages): TransformedPages => {
52
- const { data, meta } = strapiResponse;
53
- const nodes = data.map((item) => ({
54
- __typename: "Page",
55
- id: item.id.toString(),
56
- slug: item.attributes.slug,
57
- title: item.attributes.title,
58
- content: item.attributes.content,
59
- isBlog: item.attributes.isBlog,
60
- modified: item.attributes.updatedAt,
61
- modifiedBy: null,
62
- created: item.attributes.createdAt,
63
- }));
64
-
65
- return {
66
- __typename: "PageConnection",
67
- recordCount: meta.pagination.total,
68
- pageInfo: {
69
- __typename: "PageInfo",
70
- top: 50,
71
- skip: 0,
72
- sort: "modified",
73
- sortDesc: false,
74
- search: "",
75
- },
76
- nodes: nodes,
77
- };
78
- };
79
-
80
- export interface Page {
81
- data: {
82
- id: number;
83
- attributes: {
84
- title: string;
85
- content: string;
86
- isBlog: boolean;
87
- createdAt: string;
88
- updatedAt: string;
89
- publishedAt: string;
90
- };
91
- };
92
- meta: {
93
- pagination: {
94
- page: number;
95
- pageSize: number;
96
- pageCount: number;
97
- total: number;
98
- };
99
- };
100
- }
101
-
102
- export interface TransformedPage {
103
- __typename: string;
104
- id: string;
105
- title: string;
106
- content: string;
107
- isBlog: boolean;
108
- created: string;
109
- }
110
-
111
- export const transformPage = (response: Page): TransformedPage => {
112
- const { data } = response;
113
-
114
- return {
115
- __typename: "Page",
116
- id: data.id.toString(),
117
- title: data.attributes.title,
118
- content: data.attributes.content,
119
- isBlog: data.attributes.isBlog,
120
- created: data.attributes.createdAt,
121
- };
122
- };
123
-
124
- interface PageData {
125
- title: string;
126
- content: string;
127
- isBlog: boolean;
128
- }
129
-
130
- export const createPage = async (pageData: PageData) => {
131
- try {
132
- const response = await fetch(cmsEndPoints.getCmsApiUrl("pages"), {
133
- method: "POST",
134
- headers: { "Content-Type": "application/json" },
135
- body: JSON.stringify({
136
- data: pageData,
137
- }),
138
- });
139
-
140
- if (!response.ok) {
141
- throw new Error(`HTTP error! Status: ${response.status}`);
142
- }
143
-
144
- return await response.json();
145
- } catch (error) {
146
- console.error("Error creating page:", error);
147
- throw error;
148
- }
149
- };