diff --git a/src/fixtures.ts b/src/fixtures.ts index 9c3394411..77e9e4264 100644 --- a/src/fixtures.ts +++ b/src/fixtures.ts @@ -430,6 +430,18 @@ export const permissions: ShopInfo_shop_permissions[] = [ { code: PermissionEnum.MANAGE_USERS, name: "Manage customers." + }, + { + code: PermissionEnum.MANAGE_PLUGINS, + name: "Manage plugins." + }, + { + code: PermissionEnum.MANAGE_SERVICE_ACCOUNTS, + name: "Manage service accounts." + }, + { + code: PermissionEnum.MANAGE_WEBHOOKS, + name: "Manage webhooks." } ].map(perm => ({ __typename: "PermissionDisplay" as "PermissionDisplay", diff --git a/src/orders/components/OrderCustomer/OrderCustomer.tsx b/src/orders/components/OrderCustomer/OrderCustomer.tsx index ede68908b..8b3677557 100644 --- a/src/orders/components/OrderCustomer/OrderCustomer.tsx +++ b/src/orders/components/OrderCustomer/OrderCustomer.tsx @@ -86,6 +86,7 @@ const OrderCustomer = withStyles(styles, { name: "OrderCustomer" })( const intl = useIntl(); const user = maybe(() => order.user); + const userEmail = maybe(()=>order.userEmail) const [userDisplayName, setUserDisplayName] = useStateFromProps( maybe(() => user.email, "") @@ -165,9 +166,13 @@ const OrderCustomer = withStyles(styles, { name: "OrderCustomer" })( }} ) : user === null ? ( - - - + userEmail === null ? ( + + + + ) : ( + {userEmail} + ) ) : ( <> diff --git a/src/shipping/components/ShippingZonesListPage/ShippingZonesListPage.tsx b/src/shipping/components/ShippingZonesListPage/ShippingZonesListPage.tsx index 982c7a161..06a3c84f8 100644 --- a/src/shipping/components/ShippingZonesListPage/ShippingZonesListPage.tsx +++ b/src/shipping/components/ShippingZonesListPage/ShippingZonesListPage.tsx @@ -5,9 +5,7 @@ import AppHeader from "@saleor/components/AppHeader"; import Container from "@saleor/components/Container"; import Grid from "@saleor/components/Grid"; import PageHeader from "@saleor/components/PageHeader"; -import RequirePermissions, { - hasPermissions -} from "@saleor/components/RequirePermissions"; +import RequirePermissions from "@saleor/components/RequirePermissions"; import { sectionNames } from "@saleor/intl"; import { ListActions, PageListProps, UserPermissionProps } from "@saleor/types"; import { PermissionEnum, WeightUnitsEnum } from "@saleor/types/globalTypes"; diff --git a/src/staff/fixtures.ts b/src/staff/fixtures.ts index 30aed1a14..5909919f2 100644 --- a/src/staff/fixtures.ts +++ b/src/staff/fixtures.ts @@ -1,5 +1,5 @@ import avatarImage from "@assets/images/avatars/avatar1.png"; -import { PermissionEnum } from "../types/globalTypes"; +import { permissions } from "@saleor/fixtures"; import { StaffList_staffUsers_edges_node } from "./types/StaffList"; import { StaffMemberDetails_user } from "./types/StaffMemberDetails"; @@ -145,49 +145,5 @@ export const staffMember: StaffMemberDetails_user = { id: "VXNlcjoyMQ==", isActive: true, lastName: "Smith", - permissions: [ - { - code: PermissionEnum.IMPERSONATE_USERS, - name: "Impersonate customers." - }, - { - code: PermissionEnum.MANAGE_DISCOUNTS, - name: "Manage sales and vouchers." - }, - { - code: PermissionEnum.MANAGE_MENUS, - name: "Manage navigation." - }, - { - code: PermissionEnum.MANAGE_ORDERS, - name: "Manage orders." - }, - { - code: PermissionEnum.MANAGE_PAGES, - name: "Manage pages." - }, - { - code: PermissionEnum.MANAGE_PRODUCTS, - name: "Manage products." - }, - { - code: PermissionEnum.MANAGE_SETTINGS, - name: "Manage settings." - }, - { - code: PermissionEnum.MANAGE_SHIPPING, - name: "Manage shipping." - }, - { - code: PermissionEnum.MANAGE_STAFF, - name: "Manage staff." - }, - { - code: PermissionEnum.MANAGE_USERS, - name: "Manage customers." - } - ].map(perm => ({ - __typename: "PermissionDisplay" as "PermissionDisplay", - ...perm - })) + permissions }; diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index d3f3bcc56..391c45ee5 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -7067,40 +7067,14 @@ exports[`Storyshots Orders / OrderCustomer default 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -7205,40 +7179,14 @@ exports[`Storyshots Orders / OrderCustomer editable 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -7381,27 +7329,6 @@ exports[`Storyshots Orders / OrderCustomer loading 1`] = `
-
-
-

- Contact Information -

-
- - ‌ - -
-
@@ -7445,6 +7372,105 @@ exports[`Storyshots Orders / OrderCustomer loading 1`] = `
`; +exports[`Storyshots Orders / OrderCustomer no user permissions 1`] = ` +
+
+
+ + Customer + +
+
+
+
+
+

+ melissa.simon@example.com +

+
+
+
+
+

+ Shipping Address +

+
+

+ Melissa Simon +

+

+ 487 Roberto Shores +
+

+

+ 66272 West Patriciastad +

+

+ Wyspy Salomona +

+

+

+
+
+
+

+ Billing Address +

+
+

+ Same as shipping address +

+
+
+
+`; + exports[`Storyshots Orders / OrderCustomer with different addresses 1`] = `

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -29357,154 +29357,6 @@ exports[`Storyshots Views / Configuration partial access 1`] = `
-
-
-

- Product Settings -

-
-
-
-
-
- -
-
-

- Shipping Methods -

-

- Manage how you ship out orders -

-
-
-
-
-
-
- -
-
-

- Taxes -

-

- Manage how your store charges tax -

-
-
-
-
-
-
-
-

- Staff Settings -

-
-
-
-
-
- -
-
-

- Staff Members -

-

- Manage your employees and their permissions -

-
-
-
-
-
@@ -29558,44 +29410,6 @@ exports[`Storyshots Views / Configuration partial access 1`] = `
-
-
-
- -
-
-

- Site Settings -

-

- View and update your site settings -

-
-
-
@@ -29634,123 +29448,6 @@ exports[`Storyshots Views / Configuration partial access 1`] = `
-
-
-
- -
-
-

- Plugins -

-

- View and update your plugins and their settings. -

-
-
-
-
-
-
- -
-
-

- Service Accounts -

-

- Manage external integrations accounts -

-
-
-
-
-
-
- -
-
-

- Webhooks -

-

- View and update your webhook and their settings -

-
-
-
@@ -51796,6 +51493,686 @@ exports[`Storyshots Views / HomePage no data 1`] = ` `; +exports[`Storyshots Views / HomePage no permissions 1`] = ` +
+
+
+

+ Hello there, admin@example.com +

+

+ Here is some information we gathered about your store +

+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+`; + +exports[`Storyshots Views / HomePage order permissions 1`] = ` +
+
+
+

+ Hello there, admin@example.com +

+

+ Here is some information we gathered about your store +

+
+
+
+
+
+
+
+
+
+ Sales +
+ + Today + +

+ $57.15 +

+
+
+ +
+
+
+
+
+
+
+ Orders +
+ + Today + +

+ 1 +

+
+
+ +
+
+
+
+
+ + + + + + + + + + + +
+

+ + 1 + + Orders are ready to fulfill +

+
+ +
+

+ No payments waiting for capture +

+
+ +
+
+
+
+
+
+
+ + Activity + +
+
+
+
+
    +
  • +
    +

    + Order #15 was placed from draft by admin@example.com +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was fully paid +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed from draft by admin@example.com +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed from draft by admin@example.com +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed from draft by admin@example.com +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed from draft by admin@example.com +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed from draft by admin@example.com +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was placed +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was fully paid +

    +

    + +

    +
    +
  • +
  • +
    +

    + Order #15 was fully paid +

    +

    + +

    +
    +
  • +
+
+
+
+
+
+`; + +exports[`Storyshots Views / HomePage product permissions 1`] = ` +
+
+
+

+ Hello there, admin@example.com +

+

+ Here is some information we gathered about your store +

+
+
+
+
+
+ + + + + + + +
+

+ No products out of stock +

+
+ +
+
+
+
+
+
+
+
+`; + exports[`Storyshots Views / Navigation / Menu details default 1`] = `

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -57345,40 +57696,14 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -58377,40 +58702,14 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -58980,27 +59279,6 @@ exports[`Storyshots Views / Orders / Order details loading 1`] = `
-
-
-

- Contact Information -

-
- - ‌ - -
-
@@ -59982,40 +60260,14 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -61014,40 +61266,14 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -62046,40 +62272,14 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -63078,40 +63278,14 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -64110,40 +64284,14 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -65142,40 +65290,14 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -66174,40 +66296,14 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -67206,40 +67302,14 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -68238,40 +68308,14 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -69270,40 +69314,14 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` class="MuiCardContent-root-id" >

- Anonymous user + melissa.simon@example.com


-
-
-

- Contact Information -

-
- -

- melissa.simon@example.com -

-
-
-
@@ -70000,27 +70018,6 @@ exports[`Storyshots Views / Orders / Order draft default 1`] = `
-
-
-

- Contact Information -

-
-

- Not set -

-
-
@@ -70425,27 +70422,6 @@ exports[`Storyshots Views / Orders / Order draft loading 1`] = `
-
-
-

- Contact Information -

-
- - ‌ - -
-
@@ -70524,6 +70500,637 @@ exports[`Storyshots Views / Orders / Order draft loading 1`] = `
`; +exports[`Storyshots Views / Orders / Order draft no user permissions 1`] = ` +
+
+
+
+ #24 +
+
+
+
+ +
+
+
+
+
+ + + +
+
+
+
+
+ + Order Details + +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Product + + + Quantity + + Price + + Total + +
+
+
+ +
+
+

+ Davis Group (Hard) +

+ + 58-1338 + +
+
+
+
+
+
+ + +
+
+
+
+ $65.95 + + $131.90 + + +
+
+
+ +
+
+

+ Anderson PLC (15-1337) +

+ + 15-1337 + +
+
+
+
+
+
+ + +
+
+
+
+ $68.20 + + $136.40 + + +
+
+ + + + + + + + + + + + + + + + + + +
+ Subtotal + + $168.30 +
+ No applicable shipping carriers +
+ Taxes (VAT included) + + $68.30 +
+ Total + + $168.30 +
+
+
+
+

+ Order History +

+
+
+
+
+
+
+ +
+
+
+ +
+