Skip to content

Commit

Permalink
Merge branch 'main' into feat/payment-form
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus committed May 6, 2024
2 parents 9391794 + 18d8528 commit 506fe2a
Show file tree
Hide file tree
Showing 194 changed files with 5,513 additions and 3,259 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-mayflies-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vue-demo-store": minor
---

Add Account Type to register form & company name + VAT-ID fields
5 changes: 5 additions & 0 deletions .changeset/cyan-bees-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/composables-next": patch
---

Adjust types in `useProductSearch` composable
5 changes: 5 additions & 0 deletions .changeset/gold-dingos-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vue-demo-store": minor
---

Add maintenance mode page
5 changes: 5 additions & 0 deletions .changeset/mean-elephants-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/helpers-next": minor
---

Add isMaintenanceMode to check if backend is available
5 changes: 5 additions & 0 deletions .changeset/quiet-rice-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/composables-next": patch
---

Add isStackable and isDigital computed properties
5 changes: 5 additions & 0 deletions .changeset/smart-balloons-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware/api-gen": minor
---

Add Blob type support
5 changes: 5 additions & 0 deletions .changeset/spotty-ties-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/cms-base": minor
---

Add media 3D models support
5 changes: 5 additions & 0 deletions .changeset/stale-eyes-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vue-demo-store": patch
---

Separate components for order (product, custom, discount, promotion) and cart (product, promotion) item types
5 changes: 5 additions & 0 deletions .changeset/strong-kangaroos-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware/api-client": minor
---

Add error and success callbacks
64 changes: 39 additions & 25 deletions .github/workflows/check-stackblitz-templates.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
name: Stackblitz templates


run-name: Playwright stackblitz templates 🚀
on:
workflow_dispatch:
schedule:
- cron: '59 23 * * *'
on:
workflow_dispatch:
schedule:
- cron: "59 23 * * *"
jobs:
run-code_examples-tests:
runs-on: ubuntu-latest
name: Playwright testing stackblitz templates
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install dependencies
run: npm ci
- name: Install playwright browsers
run: npx playwright install --with-deps
- name: Run tests
run: npx playwright test checkStackblitzTemplates.spec.ts --project=chromium
- name: try zip the test result folder
if: failure()
run: zip -r playwright-report.zip playwright-report/
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report zip
path: playwright-report.zip
retention-days: 7
run-stackblitz-templates-tests:
runs-on: macos-14
steps:
- name: Check out code
uses: actions/checkout@v4


- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20


- run: corepack enable
- run: pnpm --version
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- name: install
run: pnpm install --no-frozen-lockfile --prefer-offline


- name: Install dependencies with Playwright
run: |
pnpm playwright install --with-deps
- name: Run tests
run: |
cd apps/e2e-tests
npx playwright test -c examples.config.ts checkStackblitzTemplates.spec.ts
8 changes: 3 additions & 5 deletions .github/workflows/failed-job-check.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Check for jobs failure
name: Send notification for jobs failure
on:
workflow_run:
workflows:
[
Code examples,
Lighthouse CI,
Vue vite blank,
Vue Blank,
Vue demo store,
Stackblitz templates,
Audit check,
]
types: [completed]
Expand All @@ -25,4 +23,4 @@ jobs:
message_format: ":fire: *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <${{github.server_url}}/${{github.repository}}/${{github.event.workflow_run.head_branch}}|${{github.repository}}>"
footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.FAIL_SLACK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.FAIL_SLACK_URL }}
4 changes: 4 additions & 0 deletions apps/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export const sidebar = [
text: "Custom Products extension",
link: "/getting-started/features/custom-products",
},
{
text: "Maintenance mode",
link: "/getting-started/features/maintenance-mode",
},
],
},
{
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
},
"devDependencies": {
"@shopware-pwa/typer": "workspace:*",
"@types/markdown-it": "13.0.7",
"@types/node": "20.11.30",
"@types/markdown-it": "14.0.1",
"@types/node": "20.12.7",
"@vitejs/plugin-vue": "5.0.4",
"typescript": "5.4.3"
"typescript": "5.4.5"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/getting-started/b2b/quote-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
useB2bQuoteManagement,
} from "@shopware-pwa/composables-next/dist";
const { cartItems } = useCart();
const { requestQuote } = UseB2bQuoteManagement();
const { requestQuote } = useB2bQuoteManagement();
const comment = ref("");
const handleRequestQuote = async () => {
await requestQuote(comment.value);
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/getting-started/features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ nav:
Collection of specific Composable Frontends Features and documentation how to use them.
<PageRef page="sitemap" title="Sitemap" sub="A Sitemap is generated by combining two sitemaps, Frontend and Shopware admin." />
<PageRef page="wishlist" title="Wishlist" sub="How to use the built-in wishlist API to create wishlist functionalities in your application." />
<PageRef page="maintenance-mode" title="Maintenance mode" sub="How to use maintenance mode with the Composable Frontends app" />

## Shopware Extensions

Expand Down
88 changes: 88 additions & 0 deletions apps/docs/src/getting-started/features/maintenance-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
head:
- - meta
- name: og:title
content: "Maintenance mode - Shopware Frontends"
- - meta
- name: og:description
content: "Example of implementation maintenance mode page"
- - meta
- name: og:image
content: "https://frontends-og-image.vercel.app/Integration:%20**Maintenance%20Mode**?fontSize=100px"
---

# Maintenance mode

You can activate the maintenance mode of your store by selecting your sales channel and then activating the maintenance mode under Status

## Detecting maintenance mode via API

Maintenance mode is returned as an error from all of the endpoints. We can detect it by using `onErrorHandler` callback function in `createAPIClient` init api method.

```ts
const apiClient = createAPIClient({
baseURL: shopwareEndpoint,
accessToken: shopwareAccessToken,
contextToken: Cookies.get("sw-context-token"),
onContextChanged(newContextToken) {
Cookies.set("sw-context-token", newContextToken, {
expires: 365, // days
path: "/",
sameSite: "lax",
});
},
onErrorHandler(response) {
const error = response._data?.errors?.find((element) => {
return element.code === "FRAMEWORK__API_SALES_CHANNEL_MAINTENANCE_MODE";
});
},
});
```

## Displaying maintenance page

:::warning
This example is for Nuxt 3 apps
:::

### Throwing MAINTENANCE_MODE error

Every error thrown within the application is automatically caught and the `error.vue` page is displayed.

```ts
onErrorHandler(response) {
const error = response._data?.errors?.find((element) => {
return element.code === "FRAMEWORK__API_SALES_CHANNEL_MAINTENANCE_MODE";
});

if (error) {
throw createError({
statusCode: 503,
statusMessage: "MAINTENANCE_MODE",
});
}
},
```

### Displaying maintenance mode page

```vue
// error.vue
<script setup lang="ts">
const props = defineProps<{
error: {
statusCode: number;
statusMessage: string;
message: string;
};
}>();
const isMaintenanceMode = computed(() => {
return props.error.statusMessage === "MAINTENANCE_MODE";
});
</script>
<template>
<div v-if="isMaintenanceMode">Maintenance Mode Page Content</div>
</template>
```
116 changes: 116 additions & 0 deletions apps/docs/src/packages/composables/useB2bQuoteManagement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
category: composables
---

# useB2bQuoteManagement

<!-- PLACEHOLDER_DESCRIPTION -->

## Usage

### Get quote list

```vue{5}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const quotesList = ref([]);
const { getQuoteList } = useB2bQuoteManagement();
onBeforeMount(async () => {
quotesList.value = await getQuoteList();
});
</script>
```

### Get quote

```vue{5}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const quote = ref();
const { getQuote } = useB2bQuoteManagement();
onBeforeMount(async () => {
quotesList.value = await getQuote('example-123');
});
</script>
```

### Decline quote

```vue{5}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const { declineQuote } = useB2bQuoteManagement();
declineQuote('example-123', 'comment');
</script>
```

### Decline quote

```vue{3}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const { declineQuote } = useB2bQuoteManagement();
declineQuote('example-123', 'comment');
</script>
```

### Request change in quote

```vue{3}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const { requestChangeQuote } = useB2bQuoteManagement();
requestChangeQuote('example-123', 'comment');
</script>
```

### Request quote

```vue{3}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const { requestQuote } = useB2bQuoteManagement();
requestQuote('comment');
</script>
```

### Create order from quote

```vue{3}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const { createOrderFromQuote } = useB2bQuoteManagement();
requestQuote('example-123', 'comment');
</script>
```

### Change quote shipping method

```vue{3}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const { changeShippingMethod } = useB2bQuoteManagement();
changeShippingMethod('example-123', 'shipping-method-id');
</script>
```

### Change quote payment method

```vue{3}
<script setup lang="ts">
import { useB2bQuoteManagement } from "@shopware-pwa/composables-next";
const { changePaymentMethod } = useB2bQuoteManagement();
changePaymentMethod('example-123', 'payment-method-id');
</script>
```

0 comments on commit 506fe2a

Please sign in to comment.