-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: shipping methods position and delivery time (#212)
- Loading branch information
1 parent
9ce1de6
commit e359aa2
Showing
39 changed files
with
355 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@shopware-pwa/composables-next": minor | ||
--- | ||
|
||
Sort shipping methods on the getShippingMethods function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@shopware-pwa/types": patch | ||
--- | ||
|
||
Add translated property to the DeliveryTime type. Fix updateAt type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"vue-demo-store": minor | ||
--- | ||
|
||
Display delivery time on the checkout page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/helpers/src/checkout/getShippingMethodDeliveryTime.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { getShippingMethodDeliveryTime } from "./getShippingMethodDeliveryTime"; | ||
import mockedShippingMethods from "./mocks/shippingMethods"; | ||
|
||
describe("getShippingMethodDeliveryTime", () => { | ||
it("should return shipping delivery time", () => { | ||
const deliveryTimeMocked = | ||
mockedShippingMethods[0].deliveryTime?.translated.name; | ||
const deliveryTime = getShippingMethodDeliveryTime( | ||
mockedShippingMethods[0] | ||
); | ||
expect(deliveryTime).toBe(deliveryTimeMocked); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/helpers/src/checkout/getShippingMethodDeliveryTime.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ShippingMethod } from "@shopware-pwa/types"; | ||
|
||
/** | ||
* Get shipping delivery time | ||
* | ||
* @param {ShippingMethod} shippingMethod | ||
*/ | ||
export function getShippingMethodDeliveryTime(shippingMethod: ShippingMethod) { | ||
return shippingMethod.deliveryTime?.translated?.name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./getShippingMethodDeliveryTime"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
import { ShippingMethod } from "@shopware-pwa/types"; | ||
const shippingMethods: ShippingMethod[] = [ | ||
{ | ||
translated: { | ||
name: "Standard", | ||
customFields: { sendcloud_service_point_enabled: "0" }, | ||
description: null, | ||
trackingUrl: null, | ||
}, | ||
createdAt: "2020-08-06T06:23:32.016+00:00", | ||
updatedAt: "2023-05-16T15:31:50.158+00:00", | ||
name: "Standard", | ||
active: true, | ||
position: 0, | ||
description: null, | ||
trackingUrl: null, | ||
deliveryTimeId: "aca1d61eafd74b2095035bb4f9a373dc", | ||
deliveryTime: { | ||
translated: { name: "Instant download", customFields: {} }, | ||
createdAt: "2023-02-06T14:41:50.564+00:00", | ||
updatedAt: null, | ||
name: "Instant download", | ||
min: 0, | ||
max: 0, | ||
unit: "hour", | ||
id: "aca1d61eafd74b2095035bb4f9a373dc", | ||
customFields: null, | ||
apiAlias: "delivery_time", | ||
}, | ||
translations: null, | ||
availabilityRule: null, | ||
prices: [ | ||
{ | ||
translated: [], | ||
createdAt: "2020-08-06T06:23:32.029+00:00", | ||
updatedAt: null, | ||
shippingMethodId: "a9d9cc502b3547f4a89eb2830c032c78", | ||
ruleId: null, | ||
calculation: 1, | ||
quantityStart: 0, | ||
quantityEnd: null, | ||
calculationRuleId: null, | ||
currencyPrice: [ | ||
{ | ||
currencyId: "b7d2554b0ce847cd82f3ac9bd1c0dfca", | ||
net: 0, | ||
gross: 0, | ||
linked: false, | ||
listPrice: null, | ||
percentage: null, | ||
regulationPrice: null, | ||
apiAlias: "price", | ||
}, | ||
], | ||
id: "09163f081c0246e2b3348bedce814c75", | ||
customFields: null, | ||
apiAlias: "shipping_method_price", | ||
}, | ||
{ | ||
translated: [], | ||
createdAt: "2020-08-06T06:26:54.179+00:00", | ||
updatedAt: null, | ||
shippingMethodId: "a9d9cc502b3547f4a89eb2830c032c78", | ||
ruleId: null, | ||
calculation: 1, | ||
quantityStart: 0, | ||
quantityEnd: null, | ||
calculationRuleId: null, | ||
currencyPrice: [ | ||
{ | ||
currencyId: "b7d2554b0ce847cd82f3ac9bd1c0dfca", | ||
net: 0, | ||
gross: 0, | ||
linked: false, | ||
listPrice: null, | ||
percentage: null, | ||
regulationPrice: null, | ||
apiAlias: "price", | ||
}, | ||
], | ||
id: "0b4ce04df7f847be809e2835541ea63f", | ||
customFields: null, | ||
apiAlias: "shipping_method_price", | ||
}, | ||
], | ||
mediaId: null, | ||
media: null, | ||
tags: null, | ||
taxType: "auto", | ||
tax: null, | ||
id: "a9d9cc502b3547f4a89eb2830c032c78", | ||
customFields: { sendcloud_service_point_enabled: "0" }, | ||
apiAlias: "shipping_method", | ||
}, | ||
{ | ||
translated: { | ||
name: "Express", | ||
customFields: {}, | ||
description: "Example description", | ||
trackingUrl: null, | ||
}, | ||
createdAt: "2020-08-06T06:26:54.184+00:00", | ||
updatedAt: "2023-05-01T06:45:56.010+00:00", | ||
name: "Express", | ||
active: true, | ||
position: 1, | ||
description: "Example description", | ||
trackingUrl: null, | ||
deliveryTimeId: "0caaf7f6131142f6b1fa81f3e3f6c0fb", | ||
deliveryTime: { | ||
translated: { name: "1-3 days", customFields: {} }, | ||
createdAt: "2020-08-06T06:26:54.178+00:00", | ||
updatedAt: "2020-08-06T06:26:54.182+00:00", | ||
name: "1-3 days", | ||
min: 1, | ||
max: 3, | ||
unit: "day", | ||
id: "0caaf7f6131142f6b1fa81f3e3f6c0fb", | ||
customFields: null, | ||
apiAlias: "delivery_time", | ||
}, | ||
translations: null, | ||
availabilityRule: null, | ||
prices: [ | ||
{ | ||
translated: [], | ||
createdAt: "2020-08-06T06:26:54.184+00:00", | ||
updatedAt: "2023-04-28T15:25:35.319+00:00", | ||
shippingMethodId: "79ef7bea9b7d49fb9d32b235fb18aa18", | ||
ruleId: "438d0573b5184c6b97af290dbf9f53a2", | ||
calculation: 1, | ||
quantityStart: 1, | ||
quantityEnd: 1, | ||
calculationRuleId: null, | ||
currencyPrice: [ | ||
{ | ||
currencyId: "b7d2554b0ce847cd82f3ac9bd1c0dfca", | ||
net: 1.1, | ||
gross: 1, | ||
linked: false, | ||
listPrice: null, | ||
percentage: null, | ||
regulationPrice: null, | ||
apiAlias: "price", | ||
}, | ||
], | ||
id: "20edde6c66ad448ea72647f6e739654a", | ||
customFields: null, | ||
apiAlias: "shipping_method_price", | ||
}, | ||
{ | ||
translated: [], | ||
createdAt: "2023-04-28T07:53:02.297+00:00", | ||
updatedAt: "2023-04-28T15:25:35.319+00:00", | ||
shippingMethodId: "79ef7bea9b7d49fb9d32b235fb18aa18", | ||
ruleId: "438d0573b5184c6b97af290dbf9f53a2", | ||
calculation: 1, | ||
quantityStart: 2, | ||
quantityEnd: 2, | ||
calculationRuleId: null, | ||
currencyPrice: [ | ||
{ | ||
currencyId: "b7d2554b0ce847cd82f3ac9bd1c0dfca", | ||
net: 2.2, | ||
gross: 2, | ||
linked: false, | ||
listPrice: null, | ||
percentage: null, | ||
regulationPrice: null, | ||
apiAlias: "price", | ||
}, | ||
], | ||
id: "21d63d5b00634d8cb25c34c0909cc37c", | ||
customFields: null, | ||
apiAlias: "shipping_method_price", | ||
}, | ||
{ | ||
translated: [], | ||
createdAt: "2023-04-28T15:25:35.320+00:00", | ||
updatedAt: null, | ||
shippingMethodId: "79ef7bea9b7d49fb9d32b235fb18aa18", | ||
ruleId: "438d0573b5184c6b97af290dbf9f53a2", | ||
calculation: 1, | ||
quantityStart: 3, | ||
quantityEnd: null, | ||
calculationRuleId: null, | ||
currencyPrice: [ | ||
{ | ||
currencyId: "b7d2554b0ce847cd82f3ac9bd1c0dfca", | ||
net: 2.2, | ||
gross: 2, | ||
linked: false, | ||
listPrice: null, | ||
percentage: null, | ||
regulationPrice: null, | ||
apiAlias: "price", | ||
}, | ||
], | ||
id: "f8916a8043ce42efa51d7519f943627f", | ||
customFields: null, | ||
apiAlias: "shipping_method_price", | ||
}, | ||
], | ||
mediaId: null, | ||
media: null, | ||
tags: null, | ||
taxType: "auto", | ||
tax: null, | ||
id: "79ef7bea9b7d49fb9d32b235fb18aa18", | ||
customFields: null, | ||
apiAlias: "shipping_method", | ||
}, | ||
]; | ||
|
||
export default shippingMethods; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e359aa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
shopware-frontends-docs – ./
shopware-frontends-docs-git-main-shopware-frontends.vercel.app
shopware-frontends-docs.vercel.app
shopware-frontends-docs-shopware-frontends.vercel.app
frontends.shopware.com