Skip to content

Commit a3078d4

Browse files
authored
fix: asset loading with vite (#182)
fixes shopware/shopware#7706
1 parent 0f66bd3 commit a3078d4

File tree

20 files changed

+50
-72
lines changed

20 files changed

+50
-72
lines changed

Diff for: src/Resources/app/administration/jest.config.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default {
3737

3838
moduleNameMapper: {
3939
'^SwagPayPal(.*)$': '<rootDir>/src$1',
40-
'^SwagPayPal/static/(.*)$': '<rootDir>/static/$1',
4140
'^src(.*)$': `${process.env.ADMIN_PATH}/src$1`,
4241
'^@shopware-ag/meteor-admin-sdk/es/(.*)': `${process.env.ADMIN_PATH}/node_modules/@shopware-ag/meteor-admin-sdk/umd/$1`,
4342
'^@shopware-ag/meteor-component-library$': `${process.env.ADMIN_PATH}/node_modules/@shopware-ag/meteor-component-library/dist/common/index.js`,

Diff for: src/Resources/app/administration/src/app/assets/icons/svg/icons-paypal-multicolor.svg

-7
This file was deleted.

Diff for: src/Resources/app/administration/src/module/extension/sw-sales-channel-modal-detail/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import template from './sw-sales-channel-modal-detail.html.twig';
22
import './sw-sales-channel-modal-detail.scss';
33
import { PAYPAL_POS_SALES_CHANNEL_TYPE_ID } from '../../../constant/swag-paypal.constant';
4-
import paypalPosLogo from 'SwagPayPal/static/img/paypal-pos-logo.svg';
54

65
export default Shopware.Component.wrapComponentConfig({
76
template,
87

9-
data() {
10-
return { paypalPosLogo };
8+
computed: {
9+
assetFilter() {
10+
return Shopware.Filter.getByName('asset');
11+
},
1112
},
1213

1314
methods: {

Diff for: src/Resources/app/administration/src/module/extension/sw-sales-channel-modal-detail/sw-sales-channel-modal-detail.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
>
66
<img
77
class="swag-paypal-pos-modal-detail__icon"
8-
:src="paypalPosLogo"
8+
:src="assetFilter('swagpaypal/administration/static/img/paypal-pos-logo.svg')"
99
>
1010
</span>
1111

Diff for: src/Resources/app/administration/src/module/extension/sw-sales-channel-modal-grid/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import template from './sw-sales-channel-modal-grid.html.twig';
22
import './sw-sales-channel-modal-grid.scss';
33
import { PAYPAL_POS_SALES_CHANNEL_TYPE_ID } from '../../../constant/swag-paypal.constant';
4-
import paypalPosLogo from 'SwagPayPal/static/img/paypal-pos-logo.svg?url';
54

65
// salesChannelTypes is from extended component - fake the existence of salesChannelTypes
76
export default Shopware.Component.wrapComponentConfig<{ salesChannelTypes: TEntityCollection<'sales_channel_type'> }>({
87
template,
98

10-
data() {
11-
return { paypalPosLogo };
9+
computed: {
10+
assetFilter() {
11+
return Shopware.Filter.getByName('asset');
12+
},
1213
},
1314

1415
methods: {

Diff for: src/Resources/app/administration/src/module/extension/sw-sales-channel-modal-grid/sw-sales-channel-modal-grid.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
>
1616
<img
1717
class="swag-paypal-pos-modal-grid__icon"
18-
:src="paypalPosLogo"
18+
:src="assetFilter('swagpaypal/administration/static/img/paypal-pos-logo.svg')"
1919
>
2020
</span>
2121
</sw-grid-column>

Diff for: src/Resources/app/administration/src/module/swag-paypal-method/view/swag-paypal-method-card/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import template from './swag-paypal-method-card.html.twig';
22
import './swag-paypal-method-card.scss';
3-
import paypalLogoAvatar from 'SwagPayPal/static/img/paypal-logo-avatar.svg?url';
43

54
const { Context } = Shopware;
65
const { Criteria } = Shopware.Data;
@@ -23,13 +22,16 @@ export default Shopware.Component.wrapComponentConfig({
2322
paymentMethods: TEntity<'payment_method'>[];
2423
} {
2524
return {
26-
paypalLogoAvatar,
2725
isLoadingPaymentMethods: true,
2826
paymentMethods: [],
2927
};
3028
},
3129

3230
computed: {
31+
assetFilter() {
32+
return Shopware.Filter.getByName('asset');
33+
},
34+
3335
paymentMethodRepository(): TRepository<'payment_method'> {
3436
return this.repositoryFactory.create('payment_method');
3537
},

Diff for: src/Resources/app/administration/src/module/swag-paypal-method/view/swag-paypal-method-card/swag-paypal-method-card.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
>
55
<template #avatar>
66
<img
7-
:src="paypalLogoAvatar"
7+
:src="assetFilter('swagpaypal/administration/static/img/paypal-logo-avatar.svg')"
88
:alt="$t('swag-paypal-method.appImageAlt')"
99
>
1010
</template>

Diff for: src/Resources/app/administration/src/module/swag-paypal-pos/component/swag-paypal-pos-account/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import template from './swag-paypal-pos-account.html.twig';
22
import './swag-paypal-pos-account.scss';
3-
import paypalPosLogo from 'SwagPayPal/static/img/paypal-pos-logo.svg?url';
43

54
const { Component } = Shopware;
65

@@ -27,14 +26,17 @@ Component.register('swag-paypal-pos-account', {
2726

2827
data() {
2928
return {
30-
paypalPosLogo,
3129
isLoading: false,
3230
isError: false,
3331
merchantInfo: null,
3432
};
3533
},
3634

3735
computed: {
36+
assetFilter() {
37+
return Shopware.Filter.getByName('asset');
38+
},
39+
3840
accountName() {
3941
if (this.isError) {
4042
return this.$t('swag-paypal-pos.account.errorName');

Diff for: src/Resources/app/administration/src/module/swag-paypal-pos/component/swag-paypal-pos-account/swag-paypal-pos-account.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{% block swag_paypal_pos_account_grid_logo %}
1111
<img class="swag-paypal-pos-account__logo"
1212
alt="Zettle Logo"
13-
:src="paypalPosLogo">
13+
:src="assetFilter('/swagpaypal/administration/static/img/paypal-pos-logo.svg')">
1414
{% endblock %}
1515

1616
{% block swag_paypal_pos_account_grid_container %}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import template from './swag-paypal-pos-getting-started.html.twig';
22
import './swag-paypal-pos-getting-started.scss';
3-
import paypalPosApp from 'SwagPayPal/static/img/paypal-pos-app.png?url';
4-
import paypalPosReader from 'SwagPayPal/static/img/paypal-pos-reader.png?url';
53

64
const { Component } = Shopware;
75

86
Component.register('swag-paypal-pos-getting-started', {
97
template,
108

11-
data() {
12-
return {
13-
paypalPosApp,
14-
paypalPosReader,
15-
};
9+
computed: {
10+
assetFilter() {
11+
return Shopware.Filter.getByName('asset');
12+
},
1613
},
1714
});

Diff for: src/Resources/app/administration/src/module/swag-paypal-pos/component/swag-paypal-pos-getting-started/swag-paypal-pos-getting-started.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
{% block swag_paypal_pos_getting_started_reader_image %}
1313
<img class="swag-paypal-pos-getting-started__image"
14-
:src="paypalPosReader"
14+
:src="assetFilter('swagpaypal/administration/static/img/paypal-pos-reader.png')"
1515
:alt="$t('swag-paypal-pos.gettingStarted.readerImageAlt')">
1616
{% endblock %}
1717

@@ -50,7 +50,7 @@
5050

5151
{% block swag_paypal_pos_getting_started_app_image %}
5252
<img class="swag-paypal-pos-getting-started__image"
53-
:src="paypalPosApp"
53+
:src="assetFilter('swagpaypal/administration/static/img/paypal-pos-app.png')"
5454
:alt="$t('swag-paypal-pos.gettingStarted.appImageAlt')">
5555
{% endblock %}
5656

Diff for: src/Resources/app/administration/src/module/swag-paypal-pos/page/wizard/swag-paypal-pos-wizard-connection/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import template from './swag-paypal-pos-wizard-connection.html.twig';
22
import './swag-paypal-pos-wizard-connection.scss';
3-
import paypalPosLogoFull from 'SwagPayPal/static/img/paypal-pos-logo-full.png?url';
43

54
const { Component } = Shopware;
65

@@ -37,12 +36,17 @@ Component.register('swag-paypal-pos-wizard-connection', {
3736

3837
data() {
3938
return {
40-
paypalPosLogoFull,
4139
isConnecting: false,
4240
apiKeyUrl: this.SwagPayPalPosSettingApiService.generateApiUrl(),
4341
};
4442
},
4543

44+
computed: {
45+
assetFilter() {
46+
return Shopware.Filter.getByName('asset');
47+
},
48+
},
49+
4650
watch: {
4751
'salesChannel.extensions.paypalPosSalesChannel.apiKey'(key) {
4852
if (!key) {

Diff for: src/Resources/app/administration/src/module/swag-paypal-pos/page/wizard/swag-paypal-pos-wizard-connection/swag-paypal-pos-wizard-connection.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
{% block swag_paypal_pos_wizard_connection_new_customer_image %}
5959
<img class="swag-paypal-pos-wizard-connection__pos-logo"
60-
:src="paypalPosLogoFull"
60+
:src="assetFilter('swagpaypal/administration/static/img/paypal-pos-logo-full.png')"
6161
alt="Zettle logo">
6262
{% endblock %}
6363

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import template from './swag-paypal-settings-icon.html.twig';
22
import './swag-paypal-settings-icon.scss';
3-
import IconsPaypalMulticolor from 'SwagPayPal/app/assets/icons/svg/icons-paypal-multicolor.svg?component';
43

54
export default Shopware.Component.wrapComponentConfig({
65
template,
7-
8-
components: {
9-
IconsPaypalMulticolor,
10-
},
116
});
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
<icons-paypal-multicolor class="swag-paypal-settings-icon" />
1+
<svg
2+
class="swag-paypal-settings-icon"
3+
xmlns="http://www.w3.org/2000/svg"
4+
width="32"
5+
height="40"
6+
viewBox="0 0 48 48"
7+
>
8+
<g fill="none" fill-rule="evenodd">
9+
<path fill="#013088" d="M1.36196923,45.9634625 C0.525969231,45.9634625 -0.113723077,45.2159 0.0165846154,44.3907125 L6.62843077,2.599775 C6.80104615,1.4978375 7.75381538,0.6878375 8.87073846,0.6878375 L24.7445846,0.6878375 C30.2124308,0.6878375 34.4855077,1.8387125 36.8530462,4.5269 C39.0005846,6.9687125 39.6284308,9.6653375 39.0056615,13.6259 C39.8924308,14.0946875 40.6522769,14.670125 41.2648923,15.3636875 C43.2888923,17.66375 43.6848923,20.934125 42.9199692,24.8508125 C41.0888923,34.2265625 34.8239692,37.4665625 26.8210462,37.4665625 L25.5856615,37.4665625 C24.6075077,37.4665625 23.7748923,38.1753125 23.6225846,39.1405625 L23.5227385,39.6805625 L21.9675077,49.5220625 L21.8862769,49.9405625 C21.7322769,50.9024375 20.9013538,51.6111875 19.9232,51.6111875 L11.6630462,51.6111875 C10.9319692,51.6111875 10.3735077,50.9598125 10.4868923,50.2375625 L11.1620698,45.9634625 L1.36196923,45.9634625 Z"/>
10+
<path fill="#019CDE" d="M39.0039692,13.6255625 C38.9565846,13.927625 38.9024308,14.2364375 38.8415077,14.5536875 C36.7481231,25.271 29.5862769,28.973375 20.4393538,28.973375 L15.7821231,28.973375 C14.6635077,28.973375 13.7208923,29.783375 13.5465846,30.883625 L11.1621231,45.963125 L10.4868923,50.2375625 C10.3735077,50.9598125 10.9319692,51.6111875 11.6630462,51.6111875 L19.9232,51.6111875 C20.9013538,51.6111875 21.7322769,50.9024375 21.8862769,49.9405625 L21.9675077,49.5220625 L23.5227385,39.6805625 L23.6225846,39.1405625 C23.7748923,38.1753125 24.6075077,37.4665625 25.5856615,37.4665625 L26.8210462,37.4665625 C34.8239692,37.4665625 41.0888923,34.2265625 42.9199692,24.8508125 C43.6848923,20.934125 43.2888923,17.66375 41.2648923,15.3636875 C40.6522769,14.670125 39.8924308,14.0946875 39.0039692,13.6255625"/>
11+
<path fill="#012269" d="M36.8142923,12.7546437 C36.4944462,12.6618312 36.1644462,12.5774562 35.8259846,12.5015187 C35.4858308,12.4272687 35.1372154,12.3614562 34.7784462,12.3040812 C33.5227538,12.1015812 32.1469077,12.0053937 30.6729077,12.0053937 L18.2310615,12.0053937 C17.9247538,12.0053937 17.6336769,12.0745812 17.3730615,12.1994562 C16.7993692,12.4745187 16.3729077,13.0162062 16.2696769,13.6793937 L13.6229077,30.3957687 L13.5467538,30.8834562 C13.7210615,29.7832062 14.6636769,28.9732062 15.7822923,28.9732062 L20.4395231,28.9732062 C29.5864462,28.9732062 36.7482923,25.2691437 38.8416769,14.5535187 C38.9042923,14.2362687 38.9567538,13.9274562 39.0041385,13.6253937 C38.4744462,13.3452687 37.9007538,13.1056437 37.2830615,12.9014562 C37.1307538,12.8508312 36.9733692,12.8018937 36.8142923,12.7546437"/>
12+
</g>
13+
</svg>

Diff for: src/Resources/app/administration/src/types/shims.d.ts

-26
This file was deleted.

Diff for: src/Resources/app/administration/src/vite.config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export default {
22
resolve: {
33
alias: {
4-
'SwagPayPal/static': `${__dirname}/../static`,
54
SwagPayPal: __dirname,
65
},
76
},

Diff for: src/Resources/app/administration/tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"strictNullChecks": true,
2323

2424
"paths": {
25-
"SwagPayPal/static/*": ["./static/*"],
2625
"SwagPayPal/*": ["./src/*"],
2726
"src/*": [
2827
"./../../../../../../../src/Administration/Resources/app/administration/src/*"

Diff for: src/Util/Lifecycle/State/PosStateService.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public function addPosSalesChannelType(Context $context): void
5353
'id' => SwagPayPal::SALES_CHANNEL_TYPE_POS,
5454
'iconName' => 'regular-money-bill',
5555
'screenshotUrls' => [
56-
'swagpaypal/static/img/paypal-pos-sales-channel-type-description-family.png',
57-
'swagpaypal/static/img/paypal-pos-sales-channel-type-description-kit.png',
58-
'swagpaypal/static/img/paypal-pos-sales-channel-type-description-reader.png',
59-
'swagpaypal/static/img/paypal-pos-sales-channel-type-description-tap-payment.png',
56+
'swagpaypal/administration/static/img/paypal-pos-sales-channel-type-description-family.png',
57+
'swagpaypal/administration/static/img/paypal-pos-sales-channel-type-description-kit.png',
58+
'swagpaypal/administration/static/img/paypal-pos-sales-channel-type-description-reader.png',
59+
'swagpaypal/administration/static/img/paypal-pos-sales-channel-type-description-tap-payment.png',
6060
],
6161
'name' => 'Point of Sale – Zettle by PayPal',
6262
'manufacturer' => 'Shopware',

0 commit comments

Comments
 (0)