Skip to content

Commit 2421fb2

Browse files
Feature/blocks refactoring (#211)
feat: A major rework of the approach to the blocks - separated all block-related code from `api-harmonization` and `frontend` apps into separate packages, allowing versioning and much easier updates in other apps started using `create-o2s-app` script
1 parent e0a925e commit 2421fb2

File tree

1,025 files changed

+28606
-4349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,025 files changed

+28606
-4349
lines changed

.changeset/clever-doors-doubt.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
'@o2s/blocks.featured-service-list': major
3+
'@o2s/blocks.notification-details': major
4+
'@o2s/typescript-config': minor
5+
'@o2s/blocks.notification-list': major
6+
'@o2s/blocks.payments-history': major
7+
'@o2s/blocks.payments-summary': major
8+
'@o2s/prettier-config': minor
9+
'@o2s/utils.api-harmonization': minor
10+
'@o2s/blocks.service-details': major
11+
'@o2s/blocks.article-search': major
12+
'@o2s/blocks.orders-summary': major
13+
'@o2s/blocks.ticket-details': major
14+
'@o2s/integrations.medusajs': minor
15+
'@o2s/blocks.category-list': major
16+
'@o2s/blocks.order-details': major
17+
'@o2s/blocks.surveyjs-form': major
18+
'@o2s/blocks.ticket-recent': major
19+
'@o2s/configs.integrations': minor
20+
'@o2s/integrations.algolia': minor
21+
'@o2s/blocks.article-list': major
22+
'@o2s/blocks.invoice-list': major
23+
'@o2s/blocks.service-list': major
24+
'@o2s/blocks.user-account': major
25+
'@o2s/integrations.mocked': minor
26+
'@o2s/blocks.quick-links': major
27+
'@o2s/blocks.ticket-list': major
28+
'create-o2s-app': minor
29+
'@o2s/integrations.redis': minor
30+
'@o2s/blocks.order-list': major
31+
'@o2s/modules.surveyjs': minor
32+
'@o2s/blocks.category': major
33+
'@o2s/blocks.article': major
34+
'@o2s/utils.frontend': minor
35+
'@o2s/api-harmonization': minor
36+
'@o2s/blocks.faq': major
37+
'@o2s/framework': minor
38+
'@o2s/frontend': minor
39+
'@o2s/ui': minor
40+
'@o2s/docs': minor
41+
---
42+
43+
A major rework of the approach to the blocks - separated all block-related code from `api-harmonization` and `frontend` apps into separate packages, allowing versioning and much easier updates in other apps started using `create-o2s-app` script

.github/workflows/deploy-dev.yaml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,28 @@ jobs:
6363
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6464
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6565

66-
- name: Checkout code
67-
if: steps.changesets.outputs.published == 'true'
68-
uses: actions/checkout@v3
69-
with:
70-
ref: create-o2s-app/base
71-
72-
- name: Reset branch
73-
if: steps.changesets.outputs.published == 'true'
74-
run: |
75-
git fetch origin main:main
76-
git reset --hard main
77-
78-
- name: Update api-harmonization dependencies
79-
if: steps.changesets.outputs.published == 'true'
80-
run: npm install @o2s/framework@latest @o2s/utils.logger@latest @o2s/integrations.mocked --workspace=@o2s/api-harmonization
81-
82-
- name: Create create-o2s-app Pull Request
83-
id: cpr
84-
uses: peter-evans/create-pull-request@v7
85-
if: steps.changesets.outputs.published == 'true'
86-
with:
87-
commit-message: 'feat(create-o2s-app): update dependencies'
88-
branch: create-o2s-app/patch
89-
delete-branch: true
90-
title: 'Update dependencies in create-o2s-app'
66+
# - name: Checkout code
67+
# if: steps.changesets.outputs.published == 'true'
68+
# uses: actions/checkout@v3
69+
# with:
70+
# ref: create-o2s-app/base
71+
#
72+
# - name: Reset branch
73+
# if: steps.changesets.outputs.published == 'true'
74+
# run: |
75+
# git fetch origin main:main
76+
# git reset --hard main
77+
#
78+
# - name: Update api-harmonization dependencies
79+
# if: steps.changesets.outputs.published == 'true'
80+
# run: npm install @o2s/framework@latest @o2s/utils.logger@latest @o2s/integrations.mocked --workspace=@o2s/api-harmonization
81+
#
82+
# - name: Create create-o2s-app Pull Request
83+
# id: cpr
84+
# uses: peter-evans/create-pull-request@v7
85+
# if: steps.changesets.outputs.published == 'true'
86+
# with:
87+
# commit-message: 'feat(create-o2s-app): update dependencies'
88+
# branch: create-o2s-app/patch
89+
# delete-branch: true
90+
# title: 'Update dependencies in create-o2s-app'

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ yarn-error.log*
3535
.cursor
3636

3737
# Local history
38-
.lh
38+
.lh
39+
40+
# Storybook
41+
*storybook.log
42+
storybook-static

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
@o2s:registry=https://registry.npmjs.org
2+
@dxp:registry=https://registry.npmjs.org

.storybook/data.ts

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
import { GlobalProviderProps } from '@o2s/ui/providers/GlobalProvider';
2+
3+
export const globalProviderConfig: GlobalProviderProps['config'] = {
4+
locales: [
5+
{
6+
value: 'en',
7+
label: 'EN',
8+
},
9+
{
10+
value: 'de',
11+
label: 'DE',
12+
},
13+
{
14+
value: 'pl',
15+
label: 'PL',
16+
},
17+
],
18+
common: {
19+
header: {
20+
id: 'fqj6nnyk4irqq5b7rnc4ogsj',
21+
title: 'MOCK_HEADER_LOGON_EN',
22+
logo: {
23+
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/logo.svg',
24+
alt: 'Logo',
25+
width: 92,
26+
height: 24,
27+
},
28+
languageSwitcherLabel: 'Language',
29+
mobileMenuLabel: {
30+
open: 'Open menu',
31+
close: 'Close Menu',
32+
},
33+
userInfo: {
34+
url: '/user-account',
35+
label: 'User Profile',
36+
},
37+
items: [
38+
{
39+
__typename: 'NavigationGroup',
40+
title: 'Customer Portal',
41+
items: [
42+
{
43+
__typename: 'NavigationItem',
44+
label: 'Dashboard',
45+
url: '/',
46+
},
47+
{
48+
__typename: 'NavigationItem',
49+
label: 'Cases',
50+
url: '/cases',
51+
},
52+
{
53+
__typename: 'NavigationItem',
54+
label: 'Invoices',
55+
url: '/invoices',
56+
},
57+
{
58+
__typename: 'NavigationItem',
59+
label: 'Notifications',
60+
url: '/notifications',
61+
},
62+
{
63+
__typename: 'NavigationItem',
64+
label: 'Services',
65+
url: '/services',
66+
},
67+
{
68+
__typename: 'NavigationItem',
69+
label: 'Orders',
70+
url: '/orders',
71+
},
72+
],
73+
},
74+
{
75+
__typename: 'NavigationGroup',
76+
title: 'Help & Support',
77+
items: [
78+
{
79+
__typename: 'NavigationItem',
80+
label: 'Welcome Hub',
81+
url: '/help-and-support',
82+
},
83+
],
84+
},
85+
],
86+
notification: {
87+
url: '/notifications',
88+
label: 'Notifications',
89+
},
90+
contextSwitcher: {
91+
closeLabel: 'Close',
92+
showContextSwitcher: true,
93+
},
94+
},
95+
footer: {
96+
id: 'laee0xa1zmm9uraev3hpruho',
97+
title: 'Legal and privacy',
98+
logo: {
99+
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/logo.svg',
100+
alt: 'Logo',
101+
width: 92,
102+
height: 24,
103+
},
104+
items: [
105+
{
106+
__typename: 'NavigationGroup',
107+
title: 'Privacy Policy',
108+
items: [
109+
{
110+
label: 'Privacy Policy 1',
111+
url: 'https://hycom.digital/privacy-policy',
112+
__typename: 'NavigationItem',
113+
},
114+
{
115+
label: 'Privacy Policy 2',
116+
url: 'https://hycom.digital/privacy-policy',
117+
__typename: 'NavigationItem',
118+
},
119+
],
120+
},
121+
{
122+
__typename: 'NavigationGroup',
123+
title: 'Terms of Service',
124+
items: [
125+
{
126+
label: 'Terms of Service 1',
127+
url: 'https://hycom.digital/terms-and-conditions',
128+
__typename: 'NavigationItem',
129+
},
130+
{
131+
label: 'Terms of Service 2',
132+
url: 'https://hycom.digital/terms-and-conditions',
133+
__typename: 'NavigationItem',
134+
},
135+
],
136+
},
137+
{
138+
__typename: 'NavigationGroup',
139+
title: 'Cookies Settings',
140+
items: [
141+
{
142+
label: 'Cookies Settings 1',
143+
url: '/',
144+
__typename: 'NavigationItem',
145+
},
146+
{
147+
label: 'Cookies Settings 2',
148+
url: '/',
149+
__typename: 'NavigationItem',
150+
},
151+
],
152+
},
153+
],
154+
copyright: '© Open Self Service 2025',
155+
},
156+
},
157+
labels: {
158+
errors: {
159+
requestError: {
160+
title: 'Uh oh! Something went wrong.',
161+
content: 'There was a problem with your request.',
162+
},
163+
},
164+
dates: {
165+
today: 'Today',
166+
yesterday: 'Yesterday',
167+
},
168+
actions: {
169+
showMore: 'Show more',
170+
showLess: 'Show less',
171+
show: 'Show',
172+
hide: 'Hide',
173+
edit: 'Edit',
174+
save: 'Save',
175+
cancel: 'Cancel',
176+
delete: 'Delete',
177+
logOut: 'Log out',
178+
settings: 'Settings',
179+
renew: 'Renew',
180+
details: 'Details',
181+
},
182+
},
183+
};
184+
185+
export const globalProviderLabels: GlobalProviderProps['labels'] = {
186+
errors: {
187+
requestError: {
188+
title: 'Uh oh! Something went wrong.',
189+
content: 'There was a problem with your request.',
190+
},
191+
},
192+
dates: {
193+
today: 'Today',
194+
yesterday: 'Yesterday',
195+
},
196+
actions: {
197+
showMore: 'Show more',
198+
showLess: 'Show less',
199+
show: 'Show',
200+
hide: 'Hide',
201+
edit: 'Edit',
202+
save: 'Save',
203+
cancel: 'Cancel',
204+
delete: 'Delete',
205+
logOut: 'Log out',
206+
settings: 'Settings',
207+
renew: 'Renew',
208+
details: 'Details',
209+
},
210+
};

.storybook/main.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import type { StorybookConfig } from '@storybook/nextjs';
2+
import * as dotenv from 'dotenv';
3+
import { dirname, join } from 'path';
4+
5+
const env: {
6+
NEXT_PUBLIC_API_URL?: string;
7+
} = {};
8+
9+
dotenv.config({
10+
path: 'apps/frontend/.env.development',
11+
processEnv: env,
12+
});
13+
14+
/**
15+
* This function is used to resolve the absolute path of a package.
16+
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
17+
*/
18+
function getAbsolutePath(value: string): any {
19+
return dirname(require.resolve(join(value, 'package.json')));
20+
}
21+
22+
const config: StorybookConfig = {
23+
stories: [
24+
'../apps/frontend/src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
25+
'../packages/blocks/**/src/frontend/**/*.stories.@(js|jsx|mjs|ts|tsx)',
26+
],
27+
addons: [
28+
getAbsolutePath('@storybook/addon-docs'),
29+
getAbsolutePath('@storybook/addon-a11y'),
30+
getAbsolutePath('@storybook/addon-themes'),
31+
],
32+
framework: {
33+
name: getAbsolutePath('@storybook/nextjs'),
34+
options: {},
35+
},
36+
env: (config) => ({
37+
...config,
38+
...env,
39+
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || env.NEXT_PUBLIC_API_URL || '',
40+
}),
41+
};
42+
export default config;

.storybook/preview-head.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<link rel="preconnect" href="https://fonts.googleapis.com">
2+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
3+
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">

0 commit comments

Comments
 (0)