diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 7f112ea1e..c3afa5cd6 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -1459,6 +1459,9 @@ "context": "dialog title", "string": "Delete categories" }, + "src_dot_channel": { + "string": "Channel" + }, "src_dot_channels": { "context": "channels section name", "string": "Channels" @@ -1681,8 +1684,8 @@ "context": "tab name", "string": "All Collections" }, - "src_dot_collections_dot_components_dot_CollectionListPage_dot_4057224233": { - "string": "Search Collection" + "src_dot_collections_dot_components_dot_CollectionListPage_dot_2685595924": { + "string": "Search Collections" }, "src_dot_collections_dot_components_dot_CollectionListPage_dot_686910896": { "context": "button", @@ -1709,6 +1712,18 @@ "context": "collection availability", "string": "Availability" }, + "src_dot_collections_dot_components_dot_CollectionList_dot_published": { + "context": "collection publication date", + "string": "Published on {date}" + }, + "src_dot_collections_dot_components_dot_CollectionList_dot_unpublished": { + "context": "collection publication date", + "string": "Unpublished" + }, + "src_dot_collections_dot_components_dot_CollectionList_dot_willBePublished": { + "context": "collection publication date", + "string": "Becomes published on {date}" + }, "src_dot_collections_dot_components_dot_CollectionProducts_dot_1657559629": { "string": "No products found" }, @@ -3385,6 +3400,218 @@ "src_dot_generalInformations": { "string": "General Information" }, + "src_dot_giftCards": { + "context": "gift cards section name", + "string": "Gift Cards" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_amountLabel": { + "context": "GiftCardCreateDialog amount label", + "string": "Enter amount" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_copiedToClipboardTitle": { + "context": "GiftCardCreateDialog copied to clipboard title", + "string": "Copied to clipboard" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_copyCodeLabel": { + "context": "GiftCardCreateDialog copy code label", + "string": "Copy code" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_createdGiftCardLabel": { + "context": "GiftCardCreateDialog created gift card label", + "string": "This is the code of a created gift card:" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_createdSuccessAlertTitle": { + "context": "GiftCardCreateDialog createdSuccessAlertTitle", + "string": "Successfully created gift card" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_customerLabel": { + "context": "GiftCardCreateDialog customer label", + "string": "Customer" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_customerSubtitle": { + "context": "GiftCardCreateDialog customer subtitle", + "string": "Selected customer will be sent the generated gift card code. Someone else can redeem the gift card code. Gift card will be assigned to account which redeemed the code." + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_issueButtonLabel": { + "context": "GiftCardCreateDialog issue button label", + "string": "Issue" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_noteLabel": { + "context": "GiftCardCreateDialog note label", + "string": "Note" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_noteSubtitle": { + "context": "GiftCardCreateDialog note subtitle", + "string": "Why was this gift card issued. This note will not be shown to the customer. Note will be stored in gift card history" + }, + "src_dot_giftCards_dot_GiftCardCreateDialog_dot_title": { + "context": "GiftCardCreateDialog title", + "string": "Issue gift card" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateBalanceDialog_dot_changeButtonLabel": { + "context": "GiftCardUpdateDetailsCard set balance dialog change button label", + "string": "Change" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateBalanceDialog_dot_subtitle": { + "context": "GiftCardUpdateDetailsCard set balance dialog subtitle", + "string": "What would you like to set cards balance to. When you change the balance both values will be changed" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateBalanceDialog_dot_title": { + "context": "GiftCardUpdateDetailsCard set balance button label", + "string": "Set balance" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateBalanceDialog_dot_updatedSuccessAlertTitle": { + "context": "GiftCardUpdateDetailsCard update success alert title", + "string": "Successfully updated card balance" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateDetailsCard_dot_cardBalanceLabel": { + "context": "GiftCardUpdateDetailsCard card balance label", + "string": "Card Balance" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateDetailsCard_dot_setBalanceButtonLabel": { + "context": "GiftCardUpdateDetailsCard set balance button label", + "string": "set balance" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateDetailsCard_dot_title": { + "context": "GiftCardUpdateDetailsCard title", + "string": "Details" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_boughtByLabel": { + "context": "GiftCardUpdateInfoCard bought by label", + "string": "Bought by" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_creationLabel": { + "context": "GiftCardUpdateInfoCard creation label", + "string": "Creation" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_issuedByAppLabel": { + "context": "GiftCardUpdateInfoCard issued by app label", + "string": "Issued by app" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_issuedByLabel": { + "context": "GiftCardUpdateInfoCard issued by label", + "string": "Issued by" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_orderNumberLabel": { + "context": "GiftCardUpdateInfoCard order number label", + "string": "Order number" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_productLabel": { + "context": "GiftCardUpdateInfoCard product label", + "string": "Product bought to get gift card" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_title": { + "context": "GiftCardUpdateInfoCard title", + "string": "Card information" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdateInfoCard_dot_usedByLabel": { + "context": "GiftCardUpdateInfoCard used by label", + "string": "Used by" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdatePageHeader_dot_disableLabel": { + "context": "GiftCardEnableDisableSection enable label", + "string": "Disable" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdatePageHeader_dot_enableLabel": { + "context": "GiftCardEnableDisableSection enable label", + "string": "Enable" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdatePageHeader_dot_successfullyDisabledTitle": { + "context": "GiftCardEnableDisableSection disable success", + "string": "Successfully disabled gift card" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_GiftCardUpdatePageHeader_dot_successfullyEnabledTitle": { + "context": "GiftCardEnableDisableSection enable success", + "string": "Successfully enabled gift card" + }, + "src_dot_giftCards_dot_GiftCardUpdate_dot_title": { + "context": "GiftCardUpdateDetailsCard title", + "string": "Details" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_bulkIssue": { + "context": "GiftCardsListHeader menu item settings", + "string": "Bulk Issue" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_codeEndingWithLabel": { + "context": "GiftCardsListTable code ending with label", + "string": "Code ending with {displayCode}" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_exportCodes": { + "context": "GiftCardsListHeader menu item settings", + "string": "Export card codes" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_giftCardDisabledLabel": { + "context": "GiftCardsListTable disabled label", + "string": "Disabled" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_giftCardsTableColumnBalanceTitle": { + "context": "GiftCardsListTable column title balance", + "string": "Balance" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_giftCardsTableColumnCustomerTitle": { + "context": "GiftCardsListTable column title customer", + "string": "Used by" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_giftCardsTableColumnGiftCardTitle": { + "context": "GiftCardsListTable column title gift card", + "string": "Gift Card" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_giftCardsTableColumnProductTitle": { + "context": "GiftCardsListTable column title product", + "string": "Product" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_giftCardsTableColumnTagTitle": { + "context": "GiftCardsListTable column title tag", + "string": "Tag" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_issueButtonLabel": { + "context": "GiftCardsListHeader issue button label", + "string": "Issue card" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_noGiftCardsFound": { + "context": "GiftCardsListTable no cards found title", + "string": "No gift cards found" + }, + "src_dot_giftCards_dot_GiftCardsList_dot_settings": { + "context": "GiftCardsListHeader menu item settings", + "string": "Settings" + }, + "src_dot_giftCards_dot_components_dot_GiftCardExpirySelect_dot_expirationDateLabel": { + "context": "GiftCarUpdateDetailsExpirySection expiration date label", + "string": "Expiration date" + }, + "src_dot_giftCards_dot_components_dot_GiftCardExpirySelect_dot_expiryDateLabel": { + "context": "GiftCarUpdateDetailsExpirySection expiry date label", + "string": "Expiration date" + }, + "src_dot_giftCards_dot_components_dot_GiftCardExpirySelect_dot_expiryPeriodLabel": { + "context": "GiftCarUpdateDetailsExpirySection expiry period label", + "string": "Expiry period" + }, + "src_dot_giftCards_dot_components_dot_GiftCardExpirySelect_dot_neverExpireLabel": { + "context": "GiftCarUpdateDetailsExpirySection never expire label", + "string": "Never expire" + }, + "src_dot_giftCards_dot_components_dot_GiftCardTagInput_dot_label": { + "context": "GiftCardTagInput tag label", + "string": "Card Tag" + }, + "src_dot_giftCards_dot_components_dot_GiftCardTagInput_dot_placeholder": { + "context": "GiftCardTagInput tag placeholder", + "string": "Tag" + }, + "src_dot_giftCards_dot_components_dot_TimePeriodField_dot_dayLabel": { + "context": "TimePeriodTextWithSelectField day label", + "string": "days after usage" + }, + "src_dot_giftCards_dot_components_dot_TimePeriodField_dot_monthLabel": { + "context": "TimePeriodTextWithSelectField month label", + "string": "months after usage" + }, + "src_dot_giftCards_dot_components_dot_TimePeriodField_dot_yearLabel": { + "context": "TimePeriodTextWithSelectField year label", + "string": "years after usage" + }, "src_dot_home": { "context": "home section name", "string": "Home" @@ -5231,18 +5458,6 @@ "context": "products section name", "string": "Products" }, - "src_dot_products_dot_components_dot_ProductAvailabilityStatusLabel_dot_published": { - "context": "product publication date", - "string": "Published on {date}" - }, - "src_dot_products_dot_components_dot_ProductAvailabilityStatusLabel_dot_unpublished": { - "context": "product publication date", - "string": "Unpublished" - }, - "src_dot_products_dot_components_dot_ProductAvailabilityStatusLabel_dot_willBePublished": { - "context": "product publication date", - "string": "Becomes published on {date}" - }, "src_dot_products_dot_components_dot_ProductCategoryAndCollectionsForm_dot_1755013298": { "string": "Category" }, @@ -5466,6 +5681,18 @@ "context": "product", "string": "Name" }, + "src_dot_products_dot_components_dot_ProductList_dot_published": { + "context": "product publication date", + "string": "Published on {date}" + }, + "src_dot_products_dot_components_dot_ProductList_dot_unpublished": { + "context": "product publication date", + "string": "Unpublished" + }, + "src_dot_products_dot_components_dot_ProductList_dot_willBePublished": { + "context": "product publication date", + "string": "Becomes published on {date}" + }, "src_dot_products_dot_components_dot_ProductMediaNavigation_dot_allMedia": { "context": "section header", "string": "All Media" diff --git a/schema.graphql b/schema.graphql index ef2c6c3ad..002ae9b93 100644 --- a/schema.graphql +++ b/schema.graphql @@ -2152,18 +2152,31 @@ type GatewayConfigLine { scalar GenericScalar -type GiftCard implements Node { - code: String - user: User - created: DateTime! - startDate: Date! - endDate: Date - lastUsedOn: DateTime +type GiftCard implements Node & ObjectWithMetadata { + code: String! isActive: Boolean! + expiryDate: Date + expiryType: GiftCardExpiryTypeEnum! + tag: String + created: DateTime! + lastUsedOn: DateTime initialBalance: Money currentBalance: Money id: ID! - displayCode: String + privateMetadata: [MetadataItem]! + metadata: [MetadataItem]! + displayCode: String! + createdBy: User + usedBy: User + createdByEmail: String + usedByEmail: String + app: App + expiryPeriod: TimePeriod + product: Product + events: [GiftCardEvent!]! + user: User @deprecated(reason: "Will be removed in Saleor 4.0. Use created_by field instead") + endDate: DateTime @deprecated(reason: "Will be removed in Saleor 4.0. Use expiry_date field instead.") + startDate: DateTime @deprecated(reason: "Will be removed in Saleor 4.0.") } type GiftCardActivate { @@ -2190,11 +2203,14 @@ type GiftCardCreate { } input GiftCardCreateInput { + tag: String startDate: Date endDate: Date - balance: PositiveDecimal + balance: PriceInput! userEmail: String + expirySettings: GiftCardExpirySettingsInput! code: String + note: String } type GiftCardDeactivate { @@ -2203,6 +2219,12 @@ type GiftCardDeactivate { errors: [GiftCardError!]! } +type GiftCardDelete { + giftCardErrors: [GiftCardError!]! @deprecated(reason: "Use errors field instead. This field will be removed in Saleor 4.0.") + errors: [GiftCardError!]! + giftCard: GiftCard +} + type GiftCardError { field: String message: String @@ -2218,6 +2240,66 @@ enum GiftCardErrorCode { UNIQUE } +type GiftCardEvent implements Node { + id: ID! + date: DateTime + type: GiftCardEventsEnum + user: User + app: App + message: String + email: String + orderId: ID + orderNumber: String + tag: String + oldTag: String + balance: GiftCardEventBalance + expiry: GiftCardEventExpiry +} + +type GiftCardEventBalance { + initialBalance: Money! + currentBalance: Money! + oldInitialBalance: Money + oldCurrentBalance: Money +} + +type GiftCardEventExpiry { + expiryType: GiftCardExpiryTypeEnum + expiryPeriod: TimePeriod + expiryDate: Date + oldExpiryType: GiftCardExpiryTypeEnum + oldExpiryPeriod: TimePeriod + oldExpiryDate: Date +} + +enum GiftCardEventsEnum { + ISSUED + BOUGHT + UPDATED + ACTIVATED + DEACTIVATED + BALANCE_RESET + EXPIRY_SETTINGS_UPDATED + SENT_TO_CUSTOMER + RESENT +} + +input GiftCardExpirySettingsInput { + expiryType: GiftCardExpiryTypeEnum! + expiryDate: Date + expiryPeriod: TimePeriodInputType +} + +enum GiftCardExpiryTypeEnum { + NEVER_EXPIRE + EXPIRY_PERIOD + EXPIRY_DATE +} + +input GiftCardFilterInput { + tag: String +} + type GiftCardUpdate { giftCardErrors: [GiftCardError!]! @deprecated(reason: "Use errors field instead. This field will be removed in Saleor 4.0.") errors: [GiftCardError!]! @@ -2225,10 +2307,11 @@ type GiftCardUpdate { } input GiftCardUpdateInput { + tag: String startDate: Date endDate: Date - balance: PositiveDecimal - userEmail: String + balanceAmount: PositiveDecimal + expirySettings: GiftCardExpirySettingsInput } type Group implements Node { @@ -2868,6 +2951,7 @@ type Mutation { invoiceSendNotification(id: ID!): InvoiceSendNotification giftCardActivate(id: ID!): GiftCardActivate giftCardCreate(input: GiftCardCreateInput!): GiftCardCreate + giftCardDelete(id: ID!): GiftCardDelete giftCardDeactivate(id: ID!): GiftCardDeactivate giftCardUpdate(id: ID!, input: GiftCardUpdateInput!): GiftCardUpdate pluginUpdate(channelId: ID, id: ID!, input: PluginUpdateInput!): PluginUpdate @@ -4102,6 +4186,11 @@ enum PostalCodeRuleInclusionTypeEnum { EXCLUDE } +input PriceInput { + currency: String! + amount: PositiveDecimal! +} + input PriceRangeInput { gte: Float lte: Float @@ -4787,7 +4876,7 @@ type Query { menuItem(id: ID!, channel: String): MenuItem menuItems(channel: String, sortBy: MenuItemSortingInput, filter: MenuItemFilterInput, before: String, after: String, first: Int, last: Int): MenuItemCountableConnection giftCard(id: ID!): GiftCard - giftCards(before: String, after: String, first: Int, last: Int): GiftCardCountableConnection + giftCards(filter: GiftCardFilterInput, before: String, after: String, first: Int, last: Int): GiftCardCountableConnection plugin(id: ID!): Plugin plugins(filter: PluginFilterInput, sortBy: PluginSortingInput, before: String, after: String, first: Int, last: Int): PluginCountableConnection sale(id: ID!, channel: String): Sale @@ -5258,6 +5347,7 @@ type Shop { availablePaymentGateways(currency: String, channel: String): [PaymentGateway!]! availableExternalAuthentications: [ExternalAuthentication!]! availableShippingMethods(channel: String!, address: AddressInput): [ShippingMethod] + channelCurrencies: [String!]! countries(languageCode: LanguageCodeEnum): [CountryDisplay!]! defaultCountry: CountryDisplay defaultMailSenderName: String @@ -5525,6 +5615,22 @@ type TaxedMoneyRange { stop: TaxedMoney } +type TimePeriod { + amount: Int! + type: TimePeriodTypeEnum! +} + +input TimePeriodInputType { + amount: Int! + type: TimePeriodTypeEnum! +} + +enum TimePeriodTypeEnum { + DAY + MONTH + YEAR +} + type Transaction implements Node { id: ID! created: DateTime! @@ -6203,4 +6309,4 @@ union _Entity = App | Address | User | Group | ProductVariant | Product | Produc type _Service { sdl: String -} +} \ No newline at end of file diff --git a/src/apps/components/VerticalSpacer/VerticalSpacer.tsx b/src/apps/components/VerticalSpacer/VerticalSpacer.tsx new file mode 100644 index 000000000..255fce508 --- /dev/null +++ b/src/apps/components/VerticalSpacer/VerticalSpacer.tsx @@ -0,0 +1,23 @@ +import { makeStyles } from "@saleor/macaw-ui"; +import React from "react"; + +export interface VerticalSpacerProps { + spacing?: number; +} + +const useStyles = makeStyles( + theme => ({ + container: ({ spacing }: VerticalSpacerProps) => ({ + height: theme.spacing(spacing) + }) + }), + { name: "VerticalSpacer" } +); + +const VerticalSpacer: React.FC = ({ spacing = 1 }) => { + const classes = useStyles({ spacing }); + + return
; +}; + +export default VerticalSpacer; diff --git a/src/apps/components/VerticalSpacer/index.tsx b/src/apps/components/VerticalSpacer/index.tsx new file mode 100644 index 000000000..37a4997f8 --- /dev/null +++ b/src/apps/components/VerticalSpacer/index.tsx @@ -0,0 +1,2 @@ +export * from "./VerticalSpacer"; +export { default } from "./VerticalSpacer"; diff --git a/src/auth/hooks/useExternalAuthProvider.ts b/src/auth/hooks/useExternalAuthProvider.ts index 72d06e4d6..cee2518f9 100644 --- a/src/auth/hooks/useExternalAuthProvider.ts +++ b/src/auth/hooks/useExternalAuthProvider.ts @@ -2,7 +2,7 @@ import { DEMO_MODE } from "@saleor/config"; import { User } from "@saleor/fragments/types/User"; import { SetLocalStorage } from "@saleor/hooks/useLocalStorage"; import { commonMessages } from "@saleor/intl"; -import { getMutationStatus } from "@saleor/misc"; +import { getFullName, getMutationStatus } from "@saleor/misc"; import errorTracker from "@saleor/services/errorTracking"; import { useEffect, useRef, useState } from "react"; import { useMutation } from "react-apollo"; @@ -88,11 +88,11 @@ export function useExternalAuthProvider({ useEffect(() => { if (authPlugin && userContext) { - const { id, email, firstName, lastName } = userContext; + const { id, email } = userContext; errorTracker.setUserData({ email, id, - username: `${firstName} ${lastName}` + username: getFullName(userContext) }); if (!userContext.isStaff) { diff --git a/src/auth/hooks/useSaleorAuthProvider.ts b/src/auth/hooks/useSaleorAuthProvider.ts index e671c2e69..9be3ef406 100644 --- a/src/auth/hooks/useSaleorAuthProvider.ts +++ b/src/auth/hooks/useSaleorAuthProvider.ts @@ -2,7 +2,7 @@ import { DEMO_MODE } from "@saleor/config"; import { User } from "@saleor/fragments/types/User"; import { SetLocalStorage } from "@saleor/hooks/useLocalStorage"; import { commonMessages } from "@saleor/intl"; -import { getMutationStatus } from "@saleor/misc"; +import { getFullName, getMutationStatus } from "@saleor/misc"; import errorTracker from "@saleor/services/errorTracking"; import { isSupported as isCredentialsManagementAPISupported, @@ -66,11 +66,11 @@ export function useSaleorAuthProvider({ useEffect(() => { if (!authPlugin && userContext) { - const { id, email, firstName, lastName } = userContext; + const { id, email } = userContext; errorTracker.setUserData({ email, id, - username: `${firstName} ${lastName}` + username: getFullName(userContext) }); if (!userContext.isStaff) { diff --git a/src/collections/components/CollectionListPage/filters.ts b/src/collections/components/CollectionListPage/filters.ts index 5202405d5..dd1cf5172 100644 --- a/src/collections/components/CollectionListPage/filters.ts +++ b/src/collections/components/CollectionListPage/filters.ts @@ -56,11 +56,11 @@ export function createFilterStructure( ...createOptionsField( CollectionFilterKeys.channel, intl.formatMessage(commonMessages.channel), - [opts.channel.value], + [opts.channel?.value], false, - opts.channel.choices + opts.channel?.choices ), - active: opts.channel.active + active: opts.channel?.active } ]; } diff --git a/src/collections/types/CollectionList.ts b/src/collections/types/CollectionList.ts index cb5ceca50..f0eed9dcd 100644 --- a/src/collections/types/CollectionList.ts +++ b/src/collections/types/CollectionList.ts @@ -65,4 +65,5 @@ export interface CollectionListVariables { before?: string | null; filter?: CollectionFilterInput | null; sort?: CollectionSortingInput | null; + channel?: string | null; } diff --git a/src/collections/views/CollectionList/CollectionList.tsx b/src/collections/views/CollectionList/CollectionList.tsx index 3d42a62e5..b80ab2418 100644 --- a/src/collections/views/CollectionList/CollectionList.tsx +++ b/src/collections/views/CollectionList/CollectionList.tsx @@ -115,7 +115,6 @@ export const CollectionList: React.FC = ({ params }) => { } }); - const filterOpts = getFilterOpts(params, channelOpts); const tabs = getFilterTabs(); diff --git a/src/collections/views/CollectionList/__snapshots__/filters.test.ts.snap b/src/collections/views/CollectionList/__snapshots__/filters.test.ts.snap index 37f201d26..56ed3702a 100644 --- a/src/collections/views/CollectionList/__snapshots__/filters.test.ts.snap +++ b/src/collections/views/CollectionList/__snapshots__/filters.test.ts.snap @@ -2,6 +2,7 @@ exports[`Filtering URL params should not be empty if active filters are present 1`] = ` Object { + "channel": undefined, "status": "PUBLISHED", } `; diff --git a/src/components/ActionDialog/ActionDialog.tsx b/src/components/ActionDialog/ActionDialog.tsx index 187dd76e3..afe009f34 100644 --- a/src/components/ActionDialog/ActionDialog.tsx +++ b/src/components/ActionDialog/ActionDialog.tsx @@ -4,14 +4,14 @@ import React from "react"; import { ConfirmButtonTransitionState } from "../ConfirmButton"; import DialogButtons from "./DialogButtons"; -import { ActionDialogVariant } from "./types"; +import { ActionDialogVariant, Size } from "./types"; interface ActionDialogProps extends DialogProps { children?: React.ReactNode; confirmButtonLabel?: string; confirmButtonState: ConfirmButtonTransitionState; disabled?: boolean; - maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | false; + maxWidth?: Size | false; title: string; variant?: ActionDialogVariant; onConfirm(); diff --git a/src/components/ActionDialog/types.ts b/src/components/ActionDialog/types.ts index 2fcce1ea6..ad9440fb5 100644 --- a/src/components/ActionDialog/types.ts +++ b/src/components/ActionDialog/types.ts @@ -1 +1,3 @@ export type ActionDialogVariant = "default" | "delete" | "info"; + +export type Size = "xs" | "sm" | "md" | "lg" | "xl"; diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index 2aeeefa05..b22f4dc2d 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -11,6 +11,7 @@ import { useSavebar, useTheme } from "@saleor/macaw-ui"; +import { isDarkTheme } from "@saleor/misc"; import { staffMemberDetailsUrl } from "@saleor/staff/urls"; import classNames from "classnames"; import React from "react"; @@ -154,8 +155,7 @@ const AppLayout: React.FC = ({ children }) => { }); }; - const isDark = themeType === "dark"; - const toggleTheme = () => setTheme(isDark ? "light" : "dark"); + const toggleTheme = () => setTheme(isDarkTheme(themeType) ? "light" : "dark"); return ( <> @@ -203,7 +203,7 @@ const AppLayout: React.FC = ({ children }) => { /> )} diff --git a/src/components/AppLayout/menuStructure.ts b/src/components/AppLayout/menuStructure.ts index d12fd2d33..9463d40c6 100644 --- a/src/components/AppLayout/menuStructure.ts +++ b/src/components/AppLayout/menuStructure.ts @@ -12,6 +12,7 @@ import { } from "@saleor/configuration"; import { MenuItem } from "@saleor/configuration/ConfigurationPage"; import { User } from "@saleor/fragments/types/User"; +import { giftCardsListUrl } from "@saleor/giftCards/urls"; import { commonMessages, sectionNames } from "@saleor/intl"; import { SidebarMenuItem } from "@saleor/macaw-ui"; import { IntlShape } from "react-intl"; @@ -62,6 +63,12 @@ function createMenuStructure(intl: IntlShape, user: User): SidebarMenuItem[] { label: intl.formatMessage(sectionNames.collections), id: "collections", url: collectionListUrl() + }, + { + ariaLabel: "giftCards", + label: intl.formatMessage(sectionNames.giftCards), + id: "giftCards", + url: giftCardsListUrl() } ], iconSrc: catalogIcon, diff --git a/src/components/DeleteIconButton/DeleteIconButton.tsx b/src/components/DeleteIconButton/DeleteIconButton.tsx new file mode 100644 index 000000000..659b43ed7 --- /dev/null +++ b/src/components/DeleteIconButton/DeleteIconButton.tsx @@ -0,0 +1,11 @@ +import { IconButton, IconButtonProps } from "@material-ui/core"; +import TrashIcon from "@saleor/icons/Trash"; +import React from "react"; + +const DeleteIconButton: React.FC = ({ onClick }) => ( + + + +); + +export default DeleteIconButton; diff --git a/src/components/DeleteIconButton/index.tsx b/src/components/DeleteIconButton/index.tsx new file mode 100644 index 000000000..30d7c30f2 --- /dev/null +++ b/src/components/DeleteIconButton/index.tsx @@ -0,0 +1,2 @@ +export * from "./DeleteIconButton"; +export { default } from "./DeleteIconButton"; diff --git a/src/components/Money/Money.tsx b/src/components/Money/Money.tsx index 3f28cf3b3..c5c0707c0 100644 --- a/src/components/Money/Money.tsx +++ b/src/components/Money/Money.tsx @@ -1,35 +1,43 @@ +import { makeStyles, Typography, TypographyProps } from "@material-ui/core"; +import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer"; import React from "react"; -import { LocaleConsumer } from "../Locale"; - export interface IMoney { amount: number; currency: string; } -export interface MoneyProps { + +export interface MoneyProps extends TypographyProps { money: IMoney | null; } -export const formatMoney = (money: IMoney, locale: string) => { - try { - const formattedMoney = money.amount.toLocaleString(locale, { - currency: money.currency, - style: "currency" - }); - return formattedMoney; - } catch (error) { - return `${money.amount} ${money.currency}`; - } -}; +const useStyles = makeStyles( + () => ({ + container: { + display: "flex", + alignItems: "baseline" + } + }), + { name: "Money" } +); -export const Money: React.FC = ({ money }) => - money ? ( - - {({ locale }) => formatMoney(money, locale)} - - ) : ( - <>- +export const Money: React.FC = ({ money, ...rest }) => { + const classes = useStyles({}); + + if (!money) { + return null; + } + + return ( +
+ + {money.currency} + + + {money.amount.toFixed(2)} +
); +}; Money.displayName = "Money"; export default Money; diff --git a/src/components/Money/index.ts b/src/components/Money/index.ts index 3589ba868..dfd638702 100644 --- a/src/components/Money/index.ts +++ b/src/components/Money/index.ts @@ -15,3 +15,15 @@ export function subtractMoney(init: IMoney, ...args: IMoney[]): IMoney { currency: init.currency }; } + +export const formatMoney = (money: IMoney, locale: string) => { + try { + const formattedMoney = money.amount.toLocaleString(locale, { + currency: money.currency, + style: "currency" + }); + return formattedMoney; + } catch (error) { + return `${money.amount} ${money.currency}`; + } +}; diff --git a/src/components/PageHeader/PageHeader.tsx b/src/components/PageHeader/PageHeader.tsx index 916c7ffdb..3119c990f 100644 --- a/src/components/PageHeader/PageHeader.tsx +++ b/src/components/PageHeader/PageHeader.tsx @@ -30,9 +30,10 @@ const useStyles = makeStyles( marginTop: theme.spacing(2), padding: 0 }, + fontWeight: 700, alignSelf: "flex-start", flex: 1, - fontSize: 24 + fontSize: 48 } }), { name: "PageHeader" } diff --git a/src/components/PageTitleWithStatusChip/PageTitleWithStatusChip.tsx b/src/components/PageTitleWithStatusChip/PageTitleWithStatusChip.tsx new file mode 100644 index 000000000..8f0dd9a34 --- /dev/null +++ b/src/components/PageTitleWithStatusChip/PageTitleWithStatusChip.tsx @@ -0,0 +1,39 @@ +import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer"; +import StatusChip from "@saleor/components/StatusChip"; +import { StatusType } from "@saleor/components/StatusChip/types"; +import { makeStyles } from "@saleor/macaw-ui"; +import React from "react"; + +export interface PageTitleWithStatusChipProps { + title: string; + statusLabel: string; + statusType: StatusType; +} + +const useStyles = makeStyles( + () => ({ + container: { + alignItems: "center", + display: "flex" + } + }), + { name: "OrderDetailsPageTitleWithStatusChip" } +); + +const PageTitleWithStatusChip: React.FC = ({ + title, + statusLabel, + statusType +}) => { + const classes = useStyles({}); + + return ( +
+ {title} + + +
+ ); +}; + +export default PageTitleWithStatusChip; diff --git a/src/components/PageTitleWithStatusChip/index.tsx b/src/components/PageTitleWithStatusChip/index.tsx new file mode 100644 index 000000000..705df7c26 --- /dev/null +++ b/src/components/PageTitleWithStatusChip/index.tsx @@ -0,0 +1,2 @@ +export * from "./PageTitleWithStatusChip"; +export { default } from "./PageTitleWithStatusChip"; diff --git a/src/components/Shop/query.ts b/src/components/Shop/query.ts index 5c185fc33..a2ec1a318 100644 --- a/src/components/Shop/query.ts +++ b/src/components/Shop/query.ts @@ -13,6 +13,7 @@ const shopInfo = gql` country code } + channelCurrencies defaultCountry { code country diff --git a/src/components/Shop/types/ShopInfo.ts b/src/components/Shop/types/ShopInfo.ts index 89ee0ccdb..cb0274003 100644 --- a/src/components/Shop/types/ShopInfo.ts +++ b/src/components/Shop/types/ShopInfo.ts @@ -42,6 +42,7 @@ export interface ShopInfo_shop_permissions { export interface ShopInfo_shop { __typename: "Shop"; countries: ShopInfo_shop_countries[]; + channelCurrencies: string[]; defaultCountry: ShopInfo_shop_defaultCountry | null; defaultWeightUnit: WeightUnitsEnum | null; displayGrossPrices: boolean; diff --git a/src/components/Skeleton.tsx b/src/components/Skeleton.tsx index d6ba349a6..463ee22e1 100644 --- a/src/components/Skeleton.tsx +++ b/src/components/Skeleton.tsx @@ -33,14 +33,17 @@ interface SkeletonProps { className?: string; primary?: boolean; style?: React.CSSProperties; + children?: React.ReactNode; } const Skeleton: React.FC = props => { - const { className, primary, style } = props; + const { className, primary, style, children } = props; const classes = useStyles(props); - return ( + return children ? ( + (children as React.ReactElement) + ) : ( ) - .add("error", () => ) - .add("success", () => ) - .add("alert", () => ); + .add("neutral", () => ( + + )) + .add("error", () => ) + .add("success", () => ( + + )) + .add("alert", () => ); diff --git a/src/components/StatusChip/StatusChip.tsx b/src/components/StatusChip/StatusChip.tsx index 900607ff9..fb75d31ca 100644 --- a/src/components/StatusChip/StatusChip.tsx +++ b/src/components/StatusChip/StatusChip.tsx @@ -3,14 +3,16 @@ import { makeStyles } from "@saleor/macaw-ui"; import classNames from "classnames"; import React from "react"; +import { Size } from "../ActionDialog/types"; import { StatusType } from "./types"; export interface StatusChipProps { - type?: StatusType; + status?: StatusType; + size?: Size; label?: string; } -const StatusChipStyles = { +export const statusChipStyles = { alert: { background: "#FFF4E4" }, @@ -34,28 +36,38 @@ const StatusChipStyles = { }, successLabel: { color: "#5DC292" + }, + lg: { + padding: "4px 16px" + }, + lgLabel: { + fontSize: "1.5rem" + }, + md: { + padding: "4px 16px" + }, + mdLabel: { + fontSize: 16 } }; const useStyles = makeStyles( theme => ({ label: { - fontSize: theme.typography.body1.fontSize, fontWeight: theme.typography.fontWeightBold, textTransform: "uppercase" }, root: { borderRadius: 22, - display: "inline-block", - padding: "8px 24px" + display: "inline-block" }, - ...StatusChipStyles + ...statusChipStyles }), { name: "StatusChip" } ); const StatusChip: React.FC = props => { - const { type = StatusType.NEUTRAL, label } = props; + const { status = StatusType.NEUTRAL, size = "lg", label } = props; const classes = useStyles(props); if (!label) { @@ -63,9 +75,13 @@ const StatusChip: React.FC = props => { } return ( -
+
{label} diff --git a/src/components/TablePagination/TablePaginationActions.tsx b/src/components/TablePagination/TablePaginationActions.tsx index 68b32761a..1a6d9ec81 100644 --- a/src/components/TablePagination/TablePaginationActions.tsx +++ b/src/components/TablePagination/TablePaginationActions.tsx @@ -3,6 +3,7 @@ import { fade } from "@material-ui/core/styles/colorManipulator"; import ArrowLeft from "@material-ui/icons/ArrowLeft"; import ArrowRight from "@material-ui/icons/ArrowRight"; import { makeStyles, useTheme } from "@saleor/macaw-ui"; +import { isDarkTheme } from "@saleor/misc"; import classNames from "classnames"; import React from "react"; @@ -76,7 +77,7 @@ export const TablePaginationActions: React.FC = pro const { direction, themeType } = useTheme(); - const isDark = themeType === "dark"; + const isDark = isDarkTheme(themeType); return (
diff --git a/src/components/TextWithSelectField/TextWithSelectField.tsx b/src/components/TextWithSelectField/TextWithSelectField.tsx new file mode 100644 index 000000000..ceebb239a --- /dev/null +++ b/src/components/TextWithSelectField/TextWithSelectField.tsx @@ -0,0 +1,125 @@ +import { TextField } from "@material-ui/core"; +import SingleSelectField, { + Choices +} from "@saleor/components/SingleSelectField"; +import { ChangeEvent, FormChange } from "@saleor/hooks/useForm"; +import classNames from "classnames"; +import React from "react"; + +import { useStyles } from "./styles"; + +interface CommonFieldProps { + name: string; + type?: string; + className?: string; + label?: string; +} + +export interface TextWithSelectFieldProps { + change: FormChange; + choices: Choices; + helperText?: string; + isError?: boolean; + textFieldProps: CommonFieldProps & { + value?: string | number; + minValue?: number; + }; + selectFieldProps: CommonFieldProps & { value: string }; + containerClassName?: string; +} + +const TextWithSelectField: React.FC = ({ + change, + choices, + containerClassName, + textFieldProps, + selectFieldProps, + helperText, + isError +}) => { + const classes = useStyles(); + + const { + name: textFieldName, + value: textFieldValue, + label: textFieldLabel, + type: textFieldType, + minValue: textFieldMinValue + } = textFieldProps; + + const { + name: selectFieldName, + value: selectFieldValue, + className: selectFieldClassName + } = selectFieldProps; + + const handleSelectChange = (event: ChangeEvent) => { + // in case one of the fields in the form is empty + // we need to save the other part of the field as well + const otherTarget = { + value: textFieldValue, + name: textFieldName + }; + + change(event); + change({ target: otherTarget }); + }; + + const handleTextChange = (event: ChangeEvent) => { + const { value } = event.target; + + const otherTarget = { + value: selectFieldValue, + name: selectFieldName + }; + + // handle parsing in case of text field of type number + const parsedValue = + textFieldType === "number" && typeof value === "string" + ? parseInt(value, 10) + : value; + + change({ + ...event, + target: { ...event.target, value: parsedValue, name: event.target.name } + }); + change({ target: otherTarget }); + }; + + return ( +
+ + ) + }} + onChange={handleTextChange} + value={textFieldValue} + /> +
+ ); +}; + +export default TextWithSelectField; diff --git a/src/components/TextWithSelectField/index.tsx b/src/components/TextWithSelectField/index.tsx new file mode 100644 index 000000000..9a1bf0b36 --- /dev/null +++ b/src/components/TextWithSelectField/index.tsx @@ -0,0 +1,2 @@ +export * from "./TextWithSelectField"; +export { default } from "./TextWithSelectField"; diff --git a/src/components/TextWithSelectField/styles.ts b/src/components/TextWithSelectField/styles.ts new file mode 100644 index 000000000..b6a7aa0ca --- /dev/null +++ b/src/components/TextWithSelectField/styles.ts @@ -0,0 +1,36 @@ +import { makeStyles } from "@saleor/macaw-ui"; + +export const useStyles = makeStyles( + () => ({ + container: { + width: 400 + }, + innerContainer: { + width: "100%" + }, + textField: { + width: "100%", + paddingRight: 0, + "& input": { + maxWidth: "100%" + } + }, + textFieldCentered: { + "& input": { + paddingTop: 16, + paddingBottom: 16 + } + }, + autocompleteField: { + height: 52, + border: "none", + "& *": { + border: "none" + }, + "& *:focus": { + background: "none" + } + } + }), + { name: "TextWithSelectField" } +); diff --git a/src/config.ts b/src/config.ts index 82033d6dd..7b66671c2 100644 --- a/src/config.ts +++ b/src/config.ts @@ -22,6 +22,7 @@ export const PAGINATE_BY = 20; export const VALUES_PAGINATE_BY = 10; export type ProductListColumns = "productType" | "availability" | "price"; + export interface AppListViewSettings { [ListViews.APPS_LIST]: ListSettings; [ListViews.ATTRIBUTE_VALUE_LIST]: ListSettings; @@ -42,7 +43,9 @@ export interface AppListViewSettings { [ListViews.WAREHOUSE_LIST]: ListSettings; [ListViews.WEBHOOK_LIST]: ListSettings; [ListViews.TRANSLATION_ATTRIBUTE_VALUE_LIST]: ListSettings; + [ListViews.GIFT_CARD_LIST]: ListSettings; } + export const defaultListSettings: AppListViewSettings = { [ListViews.APPS_LIST]: { rowNumber: 10 @@ -101,10 +104,14 @@ export const defaultListSettings: AppListViewSettings = { }, [ListViews.TRANSLATION_ATTRIBUTE_VALUE_LIST]: { rowNumber: 10 + }, + [ListViews.GIFT_CARD_LIST]: { + rowNumber: PAGINATE_BY } }; export const APP_VERSION = packageInfo.version; + export const DEMO_MODE = process.env.DEMO_MODE === "true"; export const GTM_ID = process.env.GTM_ID; diff --git a/src/discounts/views/SaleList/__snapshots__/filters.test.ts.snap b/src/discounts/views/SaleList/__snapshots__/filters.test.ts.snap index 085109799..fdfa3fdd4 100644 --- a/src/discounts/views/SaleList/__snapshots__/filters.test.ts.snap +++ b/src/discounts/views/SaleList/__snapshots__/filters.test.ts.snap @@ -13,4 +13,4 @@ Object { } `; -exports[`Filtering URL params should not be empty if active filters are present 2`] = `"channel=default-channel&startedFrom=2019-12-09&startedTo=2019-12-38&status%5B0%5D=ACTIVE&status%5B1%5D=EXPIRED&type=FIXED"`; +exports[`Filtering URL params should not be empty if active filters are present 2`] = `"channel=default-channel&startedFrom=2019-12-09&startedTo=2019-12-38&status%5B%5D=ACTIVE&status%5B%5D=EXPIRED&type=FIXED"`; diff --git a/src/discounts/views/VoucherList/__snapshots__/filters.test.ts.snap b/src/discounts/views/VoucherList/__snapshots__/filters.test.ts.snap index eb2e301df..a158ba5cc 100644 --- a/src/discounts/views/VoucherList/__snapshots__/filters.test.ts.snap +++ b/src/discounts/views/VoucherList/__snapshots__/filters.test.ts.snap @@ -18,4 +18,4 @@ Object { } `; -exports[`Filtering URL params should not be empty if active filters are present 2`] = `"channel=default-channel&startedFrom=2019-12-09&startedTo=2019-12-38×UsedFrom=1×UsedTo=6&status%5B0%5D=ACTIVE&status%5B1%5D=EXPIRED&type%5B0%5D=FIXED&type%5B1%5D=SHIPPING"`; +exports[`Filtering URL params should not be empty if active filters are present 2`] = `"channel=default-channel&startedFrom=2019-12-09&startedTo=2019-12-38×UsedFrom=1×UsedTo=6&status%5B%5D=ACTIVE&status%5B%5D=EXPIRED&type%5B%5D=FIXED&type%5B%5D=SHIPPING"`; diff --git a/src/fragments/auth.ts b/src/fragments/auth.ts index c09d611eb..56c391c97 100644 --- a/src/fragments/auth.ts +++ b/src/fragments/auth.ts @@ -16,3 +16,11 @@ export const fragmentUser = gql` } } `; + +export const fragmentUserBase = gql` + fragment UserBase on User { + id + firstName + lastName + } +`; diff --git a/src/fragments/errors.ts b/src/fragments/errors.ts index 11ae6cf0e..7feab41cf 100644 --- a/src/fragments/errors.ts +++ b/src/fragments/errors.ts @@ -215,3 +215,10 @@ export const uploadErrorFragment = gql` field } `; + +export const giftCardErrorFragment = gql` + fragment GiftCardError on GiftCardError { + code + field + } +`; diff --git a/src/fragments/timePeriod.ts b/src/fragments/timePeriod.ts new file mode 100644 index 000000000..203dada8a --- /dev/null +++ b/src/fragments/timePeriod.ts @@ -0,0 +1,8 @@ +import gql from "graphql-tag"; + +export const fragmentTimePeriod = gql` + fragment TimePeriod on TimePeriod { + amount + type + } +`; diff --git a/src/fragments/types/GiftCardError.ts b/src/fragments/types/GiftCardError.ts new file mode 100644 index 000000000..296a1c622 --- /dev/null +++ b/src/fragments/types/GiftCardError.ts @@ -0,0 +1,16 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { GiftCardErrorCode } from "./../../types/globalTypes"; + +// ==================================================== +// GraphQL fragment: GiftCardError +// ==================================================== + +export interface GiftCardError { + __typename: "GiftCardError"; + code: GiftCardErrorCode; + field: string | null; +} diff --git a/src/fragments/types/MetadataFragment.ts b/src/fragments/types/MetadataFragment.ts index f36f74cca..8698e6913 100644 --- a/src/fragments/types/MetadataFragment.ts +++ b/src/fragments/types/MetadataFragment.ts @@ -20,7 +20,7 @@ export interface MetadataFragment_privateMetadata { } export interface MetadataFragment { - __typename: "App" | "Warehouse" | "ShippingZone" | "ShippingMethod" | "Product" | "ProductType" | "Attribute" | "Category" | "ProductVariant" | "DigitalContent" | "Collection" | "Page" | "PageType" | "Sale" | "Voucher" | "MenuItem" | "Menu" | "User" | "Checkout" | "Order" | "Fulfillment" | "Invoice"; + __typename: "App" | "Warehouse" | "ShippingZone" | "ShippingMethod" | "Product" | "ProductType" | "Attribute" | "Category" | "ProductVariant" | "DigitalContent" | "Collection" | "Page" | "PageType" | "Sale" | "Voucher" | "MenuItem" | "Menu" | "User" | "Checkout" | "GiftCard" | "Order" | "Fulfillment" | "Invoice"; metadata: (MetadataFragment_metadata | null)[]; privateMetadata: (MetadataFragment_privateMetadata | null)[]; } diff --git a/src/fragments/types/TimePeriod.ts b/src/fragments/types/TimePeriod.ts new file mode 100644 index 000000000..c0cc74742 --- /dev/null +++ b/src/fragments/types/TimePeriod.ts @@ -0,0 +1,16 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { TimePeriodTypeEnum } from "./../../types/globalTypes"; + +// ==================================================== +// GraphQL fragment: TimePeriod +// ==================================================== + +export interface TimePeriod { + __typename: "TimePeriod"; + amount: number; + type: TimePeriodTypeEnum; +} diff --git a/src/fragments/types/UserBase.ts b/src/fragments/types/UserBase.ts new file mode 100644 index 000000000..ffc053621 --- /dev/null +++ b/src/fragments/types/UserBase.ts @@ -0,0 +1,15 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL fragment: UserBase +// ==================================================== + +export interface UserBase { + __typename: "User"; + id: string; + firstName: string; + lastName: string; +} diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialog.tsx b/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialog.tsx new file mode 100644 index 000000000..7f652ec21 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialog.tsx @@ -0,0 +1,114 @@ +import { Dialog, DialogTitle } from "@material-ui/core"; +import { IMessage } from "@saleor/components/messages"; +import useNotifier from "@saleor/hooks/useNotifier"; +import { GiftCardCreateInput } from "@saleor/types/globalTypes"; +import commonErrorMessages from "@saleor/utils/errors/common"; +import React, { useState } from "react"; +import { useIntl } from "react-intl"; + +import GiftCardCreateDialogCodeContent from "./GiftCardCreateDialogCodeContent"; +import GiftCardCreateDialogForm, { + GiftCardCreateFormData +} from "./GiftCardCreateDialogForm"; +import { giftCardCreateDialogMessages as messages } from "./messages"; +import { useGiftCardCreateMutation } from "./mutations"; +import { GiftCardCreate } from "./types/GiftCardCreate"; +import { getGiftCardExpirySettingsInputData } from "./utils"; + +interface GiftCardCreateDialogProps { + onClose: () => void; + open: boolean; +} + +const GiftCardCreateDialog: React.FC = ({ + onClose, + open +}) => { + const intl = useIntl(); + const notify = useNotifier(); + + const [cardCode, setCardCode] = useState(null); + + const onCompleted = (data: GiftCardCreate) => { + const errors = data?.giftCardCreate?.errors; + + const notifierData: IMessage = !!errors?.length + ? { + status: "error", + text: intl.formatMessage(commonErrorMessages.unknownError) + } + : { + status: "success", + text: intl.formatMessage(messages.createdSuccessAlertTitle) + }; + + notify(notifierData); + + if (!errors?.length) { + setCardCode(data?.giftCardCreate?.giftCard?.code); + } + }; + + const getParsedSubmitInputData = ( + formData: GiftCardCreateFormData + ): GiftCardCreateInput => { + const { + balanceAmount, + balanceCurrency, + note, + tag, + selectedCustomer + } = formData; + + return { + note: note || null, + tag: tag || null, + userEmail: selectedCustomer.email || null, + balance: { + amount: balanceAmount, + currency: balanceCurrency + }, + expirySettings: getGiftCardExpirySettingsInputData(formData) + }; + }; + + const [createGiftCard, createGiftCardOpts] = useGiftCardCreateMutation({ + onCompleted + }); + + const handleSubmit = (data: GiftCardCreateFormData) => { + createGiftCard({ + variables: { + input: getParsedSubmitInputData(data) + } + }); + }; + + const handleClose = () => { + onClose(); + // dialog closing animation runs slower than prop change + // and we don't want to show the form for a split second + setTimeout(() => setCardCode(null), 0); + }; + + return ( + + {intl.formatMessage(messages.title)} + {cardCode ? ( + + ) : ( + + )} + + ); +}; + +export default GiftCardCreateDialog; diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialogCodeContent.tsx b/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialogCodeContent.tsx new file mode 100644 index 000000000..a917aa746 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialogCodeContent.tsx @@ -0,0 +1,58 @@ +import { Button, DialogContent, Typography } from "@material-ui/core"; +import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer"; +import VerticalSpacer from "@saleor/apps/components/VerticalSpacer"; +import useClipboard from "@saleor/hooks/useClipboard"; +import useNotifier from "@saleor/hooks/useNotifier"; +import { buttonMessages } from "@saleor/intl"; +import React from "react"; +import { useIntl } from "react-intl"; + +import { giftCardCreateDialogMessages as messages } from "./messages"; +import { useGiftCardCreateDialogCodeContentStyles as useStyles } from "./styles"; + +interface GiftCardCreateDialogCodeContentProps { + cardCode: string; + onClose: () => void; +} + +const GiftCardCreateDialogCodeContent: React.FC = ({ + cardCode, + onClose +}) => { + const classes = useStyles({}); + const intl = useIntl(); + const notify = useNotifier(); + const [, copy] = useClipboard(); + + const onCopyCode = () => { + copy(cardCode); + notify({ + status: "success", + text: intl.formatMessage(messages.copiedToClipboardTitle) + }); + }; + + return ( + + + {intl.formatMessage(messages.createdGiftCardLabel)} + + + + {cardCode} + + +
+ + + +
+
+ ); +}; + +export default GiftCardCreateDialogCodeContent; diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialogForm.tsx b/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialogForm.tsx new file mode 100644 index 000000000..40096f59a --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCreateDialogForm.tsx @@ -0,0 +1,172 @@ +import { DialogContent, Divider, TextField } from "@material-ui/core"; +import VerticalSpacer from "@saleor/apps/components/VerticalSpacer"; +import DialogButtons from "@saleor/components/ActionDialog/DialogButtons"; +import CardSpacer from "@saleor/components/CardSpacer"; +import TextWithSelectField from "@saleor/components/TextWithSelectField"; +import { GiftCardError } from "@saleor/fragments/types/GiftCardError"; +import GiftCardExpirySelect from "@saleor/giftCards/components/GiftCardExpirySelect"; +import GiftCardTagInput from "@saleor/giftCards/components/GiftCardTagInput"; +import useForm from "@saleor/hooks/useForm"; +import useShop from "@saleor/hooks/useShop"; +import { commonMessages } from "@saleor/intl"; +import { ConfirmButtonTransitionState } from "@saleor/macaw-ui"; +import Label from "@saleor/orders/components/OrderHistory/Label"; +import { + GiftCardExpiryTypeEnum, + TimePeriodTypeEnum +} from "@saleor/types/globalTypes"; +import { getFormErrors } from "@saleor/utils/errors"; +import { mapSingleValueNodeToChoice } from "@saleor/utils/maps"; +import React, { useState } from "react"; +import { useIntl } from "react-intl"; + +import { getGiftCardErrorMessage } from "../GiftCardUpdate/messages"; +import GiftCardCustomerSelectField from "./GiftCardCustomerSelectField"; +import { giftCardCreateDialogMessages as messages } from "./messages"; +import { useGiftCardCreateDialogFormStyles as useStyles } from "./styles"; +import { GiftCardCommonFormData, GiftCardCreateFormCustomer } from "./types"; + +export interface GiftCardCreateFormData extends GiftCardCommonFormData { + note: string; + selectedCustomer?: GiftCardCreateFormCustomer; +} + +const initialCustomer = { email: "", name: "" }; + +export const initialData: GiftCardCreateFormData = { + tag: "", + balanceAmount: 1, + balanceCurrency: null, + note: "", + expiryDate: "", + expiryType: GiftCardExpiryTypeEnum.EXPIRY_PERIOD, + expiryPeriodType: TimePeriodTypeEnum.YEAR, + expiryPeriodAmount: 1 +}; + +interface GiftCardCreateDialogFormProps { + opts: { status: ConfirmButtonTransitionState }; + apiErrors: GiftCardError[]; + onSubmit: (data: GiftCardCreateFormData) => void; + onClose: () => void; +} + +const GiftCardCreateDialogForm: React.FC = ({ + onSubmit, + opts, + onClose, + apiErrors +}) => { + const intl = useIntl(); + const classes = useStyles({}); + const shop = useShop(); + + // TEMP + const initialCurrency = shop?.channelCurrencies?.[0]; + + const [selectedCustomer, setSelectedCustomer] = useState< + GiftCardCreateFormCustomer + >(initialCustomer); + + const handleSubmit = (data: GiftCardCreateFormData) => + onSubmit({ ...data, selectedCustomer }); + + const { submit, change, data } = useForm( + { ...initialData, balanceCurrency: initialCurrency }, + handleSubmit + ); + + const formErrors = getFormErrors( + [ + "tag", + "expiryDate", + "expiryPeriod", + "customer", + "currency", + "amount", + "balance" + ], + apiErrors + ); + + const { + tag, + expiryPeriodAmount, + expiryPeriodType, + expiryType, + balanceAmount, + balanceCurrency + } = data; + + return ( + <> + + + + + + + + + + + + + ); +}; + +export default GiftCardCreateDialogForm; diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.tsx b/src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.tsx new file mode 100644 index 000000000..d1fa67dc3 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.tsx @@ -0,0 +1,61 @@ +import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField"; +import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config"; +import { commonMessages } from "@saleor/intl"; +import { getFullName } from "@saleor/misc"; +import useCustomerSearch from "@saleor/searches/useCustomerSearch"; +import { mapEdgesToItems } from "@saleor/utils/maps"; +import React from "react"; +import { useIntl } from "react-intl"; + +import { giftCardCreateDialogMessages as messages } from "./messages"; +import { GiftCardCreateFormCustomer } from "./types"; + +export interface GiftCardCustomerSelectFieldProps { + selectedCustomer: GiftCardCreateFormCustomer; + setSelectedCustomer: (customer: GiftCardCreateFormCustomer) => void; +} + +const GiftCardCustomerSelectField: React.FC = ({ + selectedCustomer, + setSelectedCustomer +}) => { + const intl = useIntl(); + + const { loadMore, search, result } = useCustomerSearch({ + variables: DEFAULT_INITIAL_SEARCH_DATA + }); + + const customers = mapEdgesToItems(result?.data?.search); + + const choices = customers?.map(({ email, firstName, lastName }) => ({ + value: email, + label: getFullName({ firstName, lastName }) + })); + + const handleSelect = (event: React.ChangeEvent) => { + const value = event.target.value; + const label = choices?.find(category => category.value === value)?.label; + + setSelectedCustomer({ email: value, name: label }); + }; + + const label = `${intl.formatMessage( + messages.customerLabel + )} *${intl.formatMessage(commonMessages.optionalField)}`; + + return ( + + ); +}; + +export default GiftCardCustomerSelectField; diff --git a/src/giftCards/GiftCardCreateDialog/index.tsx b/src/giftCards/GiftCardCreateDialog/index.tsx new file mode 100644 index 000000000..8773e4b76 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/index.tsx @@ -0,0 +1,2 @@ +export * from "./GiftCardCreateDialog"; +export { default } from "./GiftCardCreateDialog"; diff --git a/src/giftCards/GiftCardCreateDialog/messages.ts b/src/giftCards/GiftCardCreateDialog/messages.ts new file mode 100644 index 000000000..cecf392b8 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/messages.ts @@ -0,0 +1,50 @@ +import { defineMessages } from "react-intl"; + +export const giftCardCreateDialogMessages = defineMessages({ + title: { + defaultMessage: "Issue gift card", + description: "GiftCardCreateDialog title" + }, + amountLabel: { + defaultMessage: "Enter amount", + description: "GiftCardCreateDialog amount label" + }, + issueButtonLabel: { + defaultMessage: "Issue", + description: "GiftCardCreateDialog issue button label" + }, + customerLabel: { + defaultMessage: "Customer", + description: "GiftCardCreateDialog customer label" + }, + customerSubtitle: { + defaultMessage: + "Selected customer will be sent the generated gift card code. Someone else can redeem the gift card code. Gift card will be assigned to account which redeemed the code.", + description: "GiftCardCreateDialog customer subtitle" + }, + noteLabel: { + defaultMessage: "Note", + description: "GiftCardCreateDialog note label" + }, + noteSubtitle: { + defaultMessage: + "Why was this gift card issued. This note will not be shown to the customer. Note will be stored in gift card history", + description: "GiftCardCreateDialog note subtitle" + }, + createdGiftCardLabel: { + defaultMessage: "This is the code of a created gift card:", + description: "GiftCardCreateDialog created gift card label" + }, + copyCodeLabel: { + defaultMessage: "Copy code", + description: "GiftCardCreateDialog copy code label" + }, + copiedToClipboardTitle: { + defaultMessage: "Copied to clipboard", + description: "GiftCardCreateDialog copied to clipboard title" + }, + createdSuccessAlertTitle: { + defaultMessage: "Successfully created gift card", + description: "GiftCardCreateDialog createdSuccessAlertTitle" + } +}); diff --git a/src/giftCards/GiftCardCreateDialog/mutations.ts b/src/giftCards/GiftCardCreateDialog/mutations.ts new file mode 100644 index 000000000..35324ca44 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/mutations.ts @@ -0,0 +1,26 @@ +import makeMutation from "@saleor/hooks/makeMutation"; +import gql from "graphql-tag"; + +import { + GiftCardCreate, + GiftCardCreateVariables +} from "./types/GiftCardCreate"; + +const giftCardCreate = gql` + mutation GiftCardCreate($input: GiftCardCreateInput!) { + giftCardCreate(input: $input) { + giftCard { + code + } + errors { + code + field + } + } + } +`; + +export const useGiftCardCreateMutation = makeMutation< + GiftCardCreate, + GiftCardCreateVariables +>(giftCardCreate); diff --git a/src/giftCards/GiftCardCreateDialog/styles.ts b/src/giftCards/GiftCardCreateDialog/styles.ts new file mode 100644 index 000000000..187ed8243 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/styles.ts @@ -0,0 +1,25 @@ +import { makeStyles } from "@saleor/macaw-ui"; + +export const useGiftCardCreateDialogCodeContentStyles = makeStyles( + () => ({ + buttonsContainer: { + display: "flex", + justifyContent: "flex-end", + minWidth: 450 + } + }), + { name: "GiftCardCreateDialogCodeContent" } +); + +export const useGiftCardCreateDialogFormStyles = makeStyles( + () => ({ + noteField: { + width: "100%" + }, + currencySelectField: { + width: 100 + }, + balanceContainer: { width: "100%" } + }), + { name: "GiftCardCreateDialogForm" } +); diff --git a/src/giftCards/GiftCardCreateDialog/types.ts b/src/giftCards/GiftCardCreateDialog/types.ts new file mode 100644 index 000000000..06c28169c --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/types.ts @@ -0,0 +1,32 @@ +import { GiftCardError } from "@saleor/fragments/types/GiftCardError"; +import { FormChange } from "@saleor/hooks/useForm"; +import { + GiftCardExpiryTypeEnum, + TimePeriodTypeEnum +} from "@saleor/types/globalTypes"; + +export interface GiftCardCreateFormCustomer { + name: string; + email: string; +} + +export interface GiftCardCommonFormData { + tag: string; + balanceAmount: number; + balanceCurrency: string; + expiryDate: string; + expiryType: GiftCardExpiryTypeEnum; + expiryPeriodType: TimePeriodTypeEnum; + expiryPeriodAmount: number; +} + +export type GiftCardCreateFormErrors = Record< + "tag" | "expiryDate" | "expiryPeriod" | "customer" | "currency" | "amount", + GiftCardError +>; + +export interface GiftCardCreateFormCommonProps { + change: FormChange; + errors: GiftCardCreateFormErrors; + data: GiftCardCommonFormData; +} diff --git a/src/giftCards/GiftCardCreateDialog/types/GiftCardCreate.ts b/src/giftCards/GiftCardCreateDialog/types/GiftCardCreate.ts new file mode 100644 index 000000000..d0a3ecf57 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/types/GiftCardCreate.ts @@ -0,0 +1,35 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { GiftCardCreateInput, GiftCardErrorCode } from "./../../../types/globalTypes"; + +// ==================================================== +// GraphQL mutation operation: GiftCardCreate +// ==================================================== + +export interface GiftCardCreate_giftCardCreate_giftCard { + __typename: "GiftCard"; + code: string; +} + +export interface GiftCardCreate_giftCardCreate_errors { + __typename: "GiftCardError"; + code: GiftCardErrorCode; + field: string | null; +} + +export interface GiftCardCreate_giftCardCreate { + __typename: "GiftCardCreate"; + giftCard: GiftCardCreate_giftCardCreate_giftCard | null; + errors: GiftCardCreate_giftCardCreate_errors[]; +} + +export interface GiftCardCreate { + giftCardCreate: GiftCardCreate_giftCardCreate | null; +} + +export interface GiftCardCreateVariables { + input: GiftCardCreateInput; +} diff --git a/src/giftCards/GiftCardCreateDialog/utils.ts b/src/giftCards/GiftCardCreateDialog/utils.ts new file mode 100644 index 000000000..e796ab666 --- /dev/null +++ b/src/giftCards/GiftCardCreateDialog/utils.ts @@ -0,0 +1,41 @@ +import { + GiftCardExpirySettingsInput, + GiftCardExpiryTypeEnum +} from "@saleor/types/globalTypes"; + +import { GiftCardCommonFormData } from "./types"; + +export const getGiftCardExpirySettingsInputData = ({ + expiryType, + expiryDate, + expiryPeriodAmount, + expiryPeriodType +}: Pick< + GiftCardCommonFormData, + "expiryDate" | "expiryPeriodAmount" | "expiryPeriodType" | "expiryType" +>): GiftCardExpirySettingsInput => { + switch (expiryType) { + case GiftCardExpiryTypeEnum.EXPIRY_DATE: { + return { + expiryType, + expiryDate + }; + } + + case GiftCardExpiryTypeEnum.EXPIRY_PERIOD: { + return { + expiryType, + expiryPeriod: { + amount: expiryPeriodAmount, + type: expiryPeriodType + } + }; + } + + default: { + return { + expiryType + }; + } + } +}; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdate.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdate.tsx new file mode 100644 index 000000000..996e14631 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdate.tsx @@ -0,0 +1,24 @@ +import React from "react"; + +import GiftCardUpdatePage from "./GiftCardUpdatePage"; +import GiftCardDetailsProvider from "./providers/GiftCardDetailsProvider"; +import GiftCardUpdateDialogsProvider from "./providers/GiftCardUpdateDialogsProvider"; +import GiftCardUpdateFormProvider from "./providers/GiftCardUpdateFormProvider/GiftCardUpdateFormProvider"; +import { GiftCardUpdatePageUrlQueryParams } from "./types"; + +interface GiftCardUpdateProps { + params: GiftCardUpdatePageUrlQueryParams; + id: string; +} + +const GiftCardUpdate: React.FC = ({ id, params }) => ( + + + + + + + +); + +export default GiftCardUpdate; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/GiftCardUpdateBalanceDialog.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/GiftCardUpdateBalanceDialog.tsx new file mode 100644 index 000000000..8a1326ea4 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/GiftCardUpdateBalanceDialog.tsx @@ -0,0 +1,137 @@ +import { TextField, Typography } from "@material-ui/core"; +import ActionDialog from "@saleor/components/ActionDialog"; +import CardSpacer from "@saleor/components/CardSpacer"; +import Form from "@saleor/components/Form"; +import { IMessage } from "@saleor/components/messages"; +import useNotifier from "@saleor/hooks/useNotifier"; +import { getFormErrors } from "@saleor/utils/errors"; +import commonErrorMessages from "@saleor/utils/errors/common"; +import { DialogActionHandlers } from "@saleor/utils/handlers/dialogActionHandlers"; +import React from "react"; +import { useIntl } from "react-intl"; + +import { giftCardsListTableMessages as tableMessages } from "../../GiftCardsList/messages"; +import { getGiftCardErrorMessage } from "../messages"; +import { useGiftCardUpdateMutation } from "../mutations"; +import useGiftCardDetails from "../providers/GiftCardDetailsProvider/hooks/useGiftCardDetails"; +import { GiftCardUpdate } from "../types/GiftCardUpdate"; +import { giftCardUpdateBalanceDialogMessages as messages } from "./messages"; +import { useUpdateBalanceDialogStyles as useStyles } from "./styles"; + +export interface GiftCardBalanceUpdateFormData { + balanceAmount: number; +} + +const GiftCardUpdateBalanceDialog: React.FC = ({ + open, + onClose +}) => { + const intl = useIntl(); + const classes = useStyles({}); + const notify = useNotifier(); + + const { + giftCard: { + id, + currentBalance: { amount, currency } + } + } = useGiftCardDetails(); + + const initialFormData: GiftCardBalanceUpdateFormData = { + balanceAmount: amount + }; + + const onCompleted = (data: GiftCardUpdate) => { + const errors = data?.giftCardUpdate?.errors; + + const notifierData: IMessage = !!errors?.length + ? { + status: "error", + text: intl.formatMessage(commonErrorMessages.unknownError) + } + : { + status: "success", + text: intl.formatMessage(messages.updatedSuccessAlertTitle) + }; + + notify(notifierData); + + if (!errors.length) { + onClose(); + } + }; + + const [ + updateGiftCardBalance, + updateGiftCardBalanceOpts + ] = useGiftCardUpdateMutation({ + onCompleted + }); + + const handleSubmit = async ({ + balanceAmount + }: GiftCardBalanceUpdateFormData) => { + const result = await updateGiftCardBalance({ + variables: { + id, + input: { + balanceAmount + } + } + }); + + return result?.data?.giftCardUpdate?.errors; + }; + + const { loading, status, data } = updateGiftCardBalanceOpts; + + const formErrors = getFormErrors( + ["initialBalanceAmount"], + data?.giftCardUpdate?.errors + ); + + return ( +
+ {({ data, change, submit, hasChanged }) => ( + + {intl.formatMessage(messages.subtitle)} + + + {currency} +
+ ) + }} + /> + + )} + + ); +}; + +export default GiftCardUpdateBalanceDialog; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/index.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/index.tsx new file mode 100644 index 000000000..a87c1d615 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/index.tsx @@ -0,0 +1,2 @@ +export * from "./GiftCardUpdateBalanceDialog"; +export { default } from "./GiftCardUpdateBalanceDialog"; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/messages.ts new file mode 100644 index 000000000..c0df5a486 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/messages.ts @@ -0,0 +1,22 @@ +import { defineMessages } from "react-intl"; + +export const giftCardUpdateBalanceDialogMessages = defineMessages({ + title: { + defaultMessage: "Set balance", + description: "GiftCardUpdateDetailsCard set balance button label" + }, + subtitle: { + defaultMessage: + "What would you like to set cards balance to. When you change the balance both values will be changed", + description: "GiftCardUpdateDetailsCard set balance dialog subtitle" + }, + updatedSuccessAlertTitle: { + defaultMessage: "Successfully updated card balance", + description: "GiftCardUpdateDetailsCard update success alert title" + }, + changeButtonLabel: { + defaultMessage: "Change", + description: + "GiftCardUpdateDetailsCard set balance dialog change button label" + } +}); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/styles.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/styles.ts new file mode 100644 index 000000000..f5e74413d --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/styles.ts @@ -0,0 +1,17 @@ +import { makeStyles } from "@saleor/macaw-ui"; + +export const useUpdateBalanceDialogStyles = makeStyles( + theme => ({ + inputContainer: { + width: "100%" + }, + currencyCodeContainer: { + height: 35, + display: "flex", + flexDirection: "column", + justifyContent: "flex-end", + marginRight: theme.spacing(1) + } + }), + { name: "GiftCardUpdateBalanceDialog" } +); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsBalanceSection.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsBalanceSection.tsx new file mode 100644 index 000000000..d91334060 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsBalanceSection.tsx @@ -0,0 +1,50 @@ +import { Typography } from "@material-ui/core"; +import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer"; +import CardSpacer from "@saleor/components/CardSpacer"; +import Money from "@saleor/components/Money"; +import classNames from "classnames"; +import React from "react"; +import { useIntl } from "react-intl"; + +import useGiftCardDetails from "../providers/GiftCardDetailsProvider/hooks/useGiftCardDetails"; +import { giftCardUpdateDetailsCardMessages as messages } from "./messages"; +import { useGiftCardDetailsBalanceStyles as useStyles } from "./styles"; + +const GiftCardUpdateDetailsBalanceSection: React.FC = () => { + const classes = useStyles({}); + const intl = useIntl(); + + const { + giftCard: { currentBalance, initialBalance } + } = useGiftCardDetails(); + + const progressBarWidth = !!currentBalance.amount + ? Math.floor((currentBalance.amount / initialBalance.amount) * 100) + : 0; + + return ( + <> +
+ {intl.formatMessage(messages.cardBalanceLabel)} +
+ + + / + + +
+
+ +
+
+
+ + ); +}; + +export default GiftCardUpdateDetailsBalanceSection; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsCard.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsCard.tsx new file mode 100644 index 000000000..2c7e24276 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsCard.tsx @@ -0,0 +1,74 @@ +import { Button, Card, CardContent, Divider } from "@material-ui/core"; +import CardSpacer from "@saleor/components/CardSpacer"; +import CardTitle from "@saleor/components/CardTitle"; +import Skeleton from "@saleor/components/Skeleton"; +import GiftCardExpirySelect from "@saleor/giftCards/components/GiftCardExpirySelect"; +import GiftCardTagInput from "@saleor/giftCards/components/GiftCardTagInput"; +import React from "react"; +import { useIntl } from "react-intl"; + +import useGiftCardDetails from "../providers/GiftCardDetailsProvider/hooks/useGiftCardDetails"; +import useGiftCardUpdateDialogs from "../providers/GiftCardUpdateDialogsProvider/hooks/useGiftCardUpdateDialogs"; +import useGiftCardUpdateForm from "../providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdateForm"; +import GiftCardUpdateDetailsBalanceSection from "./GiftCardUpdateDetailsBalanceSection"; +import { giftCardUpdateDetailsCardMessages as messages } from "./messages"; + +const GiftCardUpdateDetailsCard: React.FC = () => { + const intl = useIntl(); + + const { loading } = useGiftCardDetails(); + const { openSetBalanceDialog } = useGiftCardUpdateDialogs(); + + const { + change, + data: { expiryType, expiryPeriodAmount, expiryPeriodType, tag, expiryDate }, + formErrors + } = useGiftCardUpdateForm(); + + return ( + + + {intl.formatMessage(messages.setBalanceButtonLabel)} + + } + /> + + + {!loading && ( + <> + + + + + + + + + )} + + + + ); +}; + +export default GiftCardUpdateDetailsCard; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/index.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/index.tsx new file mode 100644 index 000000000..9bab63df0 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/index.tsx @@ -0,0 +1,2 @@ +export * from "./GiftCardUpdateDetailsCard"; +export { default } from "./GiftCardUpdateDetailsCard"; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/messages.ts new file mode 100644 index 000000000..fd6b70ccf --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/messages.ts @@ -0,0 +1,16 @@ +import { defineMessages } from "react-intl"; + +export const giftCardUpdateDetailsCardMessages = defineMessages({ + title: { + defaultMessage: "Details", + description: "GiftCardUpdateDetailsCard title" + }, + setBalanceButtonLabel: { + defaultMessage: "set balance", + description: "GiftCardUpdateDetailsCard set balance button label" + }, + cardBalanceLabel: { + defaultMessage: "Card Balance", + description: "GiftCardUpdateDetailsCard card balance label" + } +}); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/styles.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/styles.ts new file mode 100644 index 000000000..e0e54d1a6 --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/styles.ts @@ -0,0 +1,28 @@ +import { makeStyles } from "@saleor/macaw-ui"; + +export const useGiftCardDetailsBalanceStyles = makeStyles( + theme => ({ + labelsContainer: { + display: "flex", + alignItems: "baseline" + }, + wideContainer: { + justifyContent: "space-between" + }, + balanceBar: { + width: "100%", + display: "flex", + alignItems: "center", + height: 36, + padding: "0 4px", + backgroundColor: theme.palette.background.default, + borderRadius: 18 + }, + balanceBarProgress: { + height: 28, + borderRadius: 14, + backgroundColor: theme.palette.primary.light + } + }), + { name: "GiftCardUpdateDetailsBalanceSection" } +); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCard.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCard.tsx new file mode 100644 index 000000000..b8533151a --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCard.tsx @@ -0,0 +1,26 @@ +import { Card, CardContent } from "@material-ui/core"; +import CardTitle from "@saleor/components/CardTitle"; +import Skeleton from "@saleor/components/Skeleton"; +import React from "react"; +import { useIntl } from "react-intl"; + +import useGiftCardDetails from "../providers/GiftCardDetailsProvider/hooks/useGiftCardDetails"; +import GiftCardUpdateInfoCardContent from "./GiftCardUpdateInfoCardContent"; +import { giftCardUpdateInfoCardMessages as messages } from "./messages"; + +const GiftCardUpdateInfoCard: React.FC = () => { + const intl = useIntl(); + + const { loading } = useGiftCardDetails(); + + return ( + + + + {!loading && } + + + ); +}; + +export default GiftCardUpdateInfoCard; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCardContent.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCardContent.tsx new file mode 100644 index 000000000..57caab8fc --- /dev/null +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCardContent.tsx @@ -0,0 +1,143 @@ +import { Typography } from "@material-ui/core"; +import { appUrl } from "@saleor/apps/urls"; +import CardSpacer from "@saleor/components/CardSpacer"; +import Link from "@saleor/components/Link"; +import { customerUrl } from "@saleor/customers/urls"; +import useDateLocalize from "@saleor/hooks/useDateLocalize"; +import useNavigator from "@saleor/hooks/useNavigator"; +import { getFullName, getStringOrPlaceholder } from "@saleor/misc"; +import Label from "@saleor/orders/components/OrderHistory/Label"; +import { getOrderNumberLinkObject } from "@saleor/orders/components/OrderHistory/utils"; +import { productUrl } from "@saleor/products/urls"; +import { staffMemberDetailsUrl } from "@saleor/staff/urls"; +import { GiftCardEventsEnum } from "@saleor/types/globalTypes"; +import React from "react"; +import { MessageDescriptor, useIntl } from "react-intl"; + +import useGiftCardDetails from "../providers/GiftCardDetailsProvider/hooks/useGiftCardDetails"; +import { giftCardUpdateInfoCardMessages as messages } from "./messages"; + +const PLACEHOLDER = "-"; + +const GiftCardUpdateInfoCardContent: React.FC = () => { + const intl = useIntl(); + const localizeDate = useDateLocalize(); + const navigate = useNavigator(); + + const { giftCard } = useGiftCardDetails(); + + const { + created, + createdByEmail, + createdBy, + usedByEmail, + usedBy, + app, + product, + events + } = giftCard; + + const cardIssuedEvent = events.find( + ({ type }) => type === GiftCardEventsEnum.ISSUED + ); + + const getBuyerFieldData = (): { + label: MessageDescriptor; + name: string; + url?: string; + } => { + // createdBy can be either customer or staff hence + // we check for issued event + if (cardIssuedEvent) { + const userName = getFullName(createdBy); + + return { + label: messages.issuedByLabel, + name: userName || createdByEmail, + url: staffMemberDetailsUrl(createdBy.id) + }; + } + + if (createdByEmail) { + return { + label: messages.boughtByLabel, + name: createdByEmail + }; + } + + if (app) { + return { + label: messages.issuedByAppLabel, + name: app.name, + url: appUrl(app.id) + }; + } + + return { + label: messages.boughtByLabel, + name: getFullName(createdBy), + url: customerUrl(createdBy?.id) + }; + }; + + const orderData = + cardIssuedEvent && cardIssuedEvent.orderId + ? getOrderNumberLinkObject({ + id: cardIssuedEvent.orderId, + number: cardIssuedEvent.orderNumber + }) + : null; + + const { + label: buyerLabelMessage, + name: buyerName, + url: buyerUrl + } = getBuyerFieldData(); + + return ( + <> +
2 variants
Visible since 07/30/2020
@@ -2607,11 +2609,13 @@ exports[`Storyshots Channels / Channels with variants availability card default
2 variants
Visible since 07/30/2020
@@ -5635,9 +5639,9 @@ exports[`Storyshots Generics / Deletable Item default 1`] = ` > - €14.00 +
+
+ EUR +
+
+
+ 14.00 +
+
@@ -14605,10 +14625,10 @@ exports[`Storyshots Generics / Status Chip alert 1`] = ` style="padding:24px" >
label
@@ -14621,10 +14641,10 @@ exports[`Storyshots Generics / Status Chip error 1`] = ` style="padding:24px" >
label
@@ -14637,10 +14657,10 @@ exports[`Storyshots Generics / Status Chip neutral 1`] = ` style="padding:24px" >
label
@@ -14653,10 +14673,10 @@ exports[`Storyshots Generics / Status Chip success 1`] = ` style="padding:24px" >
label
@@ -17428,6 +17448,7 @@ exports[`Storyshots Orders / OrderHistory default 1`] = ` >
Products refunded
@@ -17444,6 +17465,7 @@ exports[`Storyshots Orders / OrderHistory default 1`] = ` >
Cow's milk
@@ -17453,6 +17475,7 @@ exports[`Storyshots Orders / OrderHistory default 1`] = ` >
qty: 4
@@ -17469,6 +17492,7 @@ exports[`Storyshots Orders / OrderHistory default 1`] = ` >
Goat's milk
@@ -17478,6 +17502,7 @@ exports[`Storyshots Orders / OrderHistory default 1`] = ` >
qty: 4
@@ -17492,6 +17517,7 @@ exports[`Storyshots Orders / OrderHistory default 1`] = `
Transaction reference
@@ -22518,9 +22544,9 @@ exports[`Storyshots Shipping zones card with options selected 1`] = ` >
+
+ +
@@ -63104,27 +63144,19 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = ` data-test="availability" data-test-availability="true" > -
+
+
-
-
-
- 1/2 channels -
-
+ Unpublished
@@ -63178,7 +63210,32 @@ exports[`Storyshots Views / Collections / Collection list default 1`] = ` class="MuiTableCell-root-id MuiTableCell-body-id CollectionList-colAvailability-id" data-test="availability" data-test-availability="true" - /> + > +
+
+
+
+
+
+ 1/2 channels +
+
+
+
+
+ + > +
+
+
+
+
+
+ 1/2 channels +
+
+
+
+
+ + > +
+
+
+
+
+
+ 1/2 channels +
+
+
+
+
+ + > +
+
+
+
+
+
+ 1/2 channels +
+
+
+
+
+ + > +
+
+
+
+
+
+ 1/2 channels +
+
+
+
+
+ @@ -63468,8 +63625,22 @@ exports[`Storyshots Views / Collections / Collection list loading 1`] = `
+
+ +
@@ -63869,8 +64040,22 @@ exports[`Storyshots Views / Collections / Collection list no data 1`] = `
+
+ +
@@ -73838,7 +74023,23 @@ exports[`Storyshots Views / Customers / Customer details default 1`] = ` - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -74513,7 +74714,23 @@ exports[`Storyshots Views / Customers / Customer details different addresses 1`] - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -75243,7 +75460,23 @@ exports[`Storyshots Views / Customers / Customer details form errors 1`] = ` - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -76533,7 +76766,23 @@ exports[`Storyshots Views / Customers / Customer details never logged 1`] = ` - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -77202,7 +77451,23 @@ exports[`Storyshots Views / Customers / Customer details never placed order 1`] - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -77871,7 +78136,23 @@ exports[`Storyshots Views / Customers / Customer details no address at all 1`] = - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -78518,7 +78799,23 @@ exports[`Storyshots Views / Customers / Customer details no default billing addr - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -79193,7 +79490,23 @@ exports[`Storyshots Views / Customers / Customer details no default shipping add - $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
@@ -92902,7 +93215,23 @@ exports[`Storyshots Views / Discounts / Sale list default 1`] = ` - $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $1.00 +
+
+ USD +
+
+
+ 1.00 +
+
- $57.15 +
+
+ USD +
+
+
+ 57.15 +
+
- $37.65 +
+
+ USD +
+
+
+ 37.65 +
+
@@ -107146,7 +107619,23 @@ exports[`Storyshots Views / HomePage no data 1`] = `
- $57.15 +
+
+ USD +
+
+
+ 57.15 +
+
- $57.15 +
+
+ USD +
+
+
+ 57.15 +
+
- $305.17 +
+
+ USD +
+
+
+ 305.17 +
+
- $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
- $321.71 +
+
+ USD +
+
+
+ 321.71 +
+
- $271.95 +
+
+ USD +
+
+
+ 271.95 +
+
- $335.84 +
+
+ USD +
+
+
+ 335.84 +
+
- $1,042.15 +
+
+ USD +
+
+
+ 1042.15 +
+
- $213.69 +
+
+ USD +
+
+
+ 213.69 +
+
- $367.03 +
+
+ USD +
+
+
+ 367.03 +
+
- $298.76 +
+
+ USD +
+
+
+ 298.76 +
+
- $663.69 +
+
+ USD +
+
+
+ 663.69 +
+
- $280.41 +
+
+ USD +
+
+
+ 280.41 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
- $485.19 +
+
+ USD +
+
+
+ 485.19 +
+
- $223.54 +
+
+ USD +
+
+
+ 223.54 +
+
- $237.55 +
+
+ USD +
+
+
+ 237.55 +
+
- $453.55 +
+
+ USD +
+
+
+ 453.55 +
+
- $812.67 +
+
+ USD +
+
+
+ 812.67 +
+
- $481.41 +
+
+ USD +
+
+
+ 481.41 +
+
- $569.19 +
+
+ USD +
+
+
+ 569.19 +
+
- $557.00 +
+
+ USD +
+
+
+ 557.00 +
+
@@ -112939,7 +113764,23 @@ exports[`Storyshots Views / Orders / Draft order list limits reached 1`] = ` - $305.17 +
+
+ USD +
+
+
+ 305.17 +
+
- $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
- $321.71 +
+
+ USD +
+
+
+ 321.71 +
+
- $271.95 +
+
+ USD +
+
+
+ 271.95 +
+
- $335.84 +
+
+ USD +
+
+
+ 335.84 +
+
- $1,042.15 +
+
+ USD +
+
+
+ 1042.15 +
+
- $213.69 +
+
+ USD +
+
+
+ 213.69 +
+
- $367.03 +
+
+ USD +
+
+
+ 367.03 +
+
- $298.76 +
+
+ USD +
+
+
+ 298.76 +
+
- $663.69 +
+
+ USD +
+
+
+ 663.69 +
+
- $280.41 +
+
+ USD +
+
+
+ 280.41 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
- $485.19 +
+
+ USD +
+
+
+ 485.19 +
+
- $223.54 +
+
+ USD +
+
+
+ 223.54 +
+
- $237.55 +
+
+ USD +
+
+
+ 237.55 +
+
- $453.55 +
+
+ USD +
+
+
+ 453.55 +
+
- $812.67 +
+
+ USD +
+
+
+ 812.67 +
+
- $481.41 +
+
+ USD +
+
+
+ 481.41 +
+
- $569.19 +
+
+ USD +
+
+
+ 569.19 +
+
- $557.00 +
+
+ USD +
+
+
+ 557.00 +
+
@@ -116702,20 +117847,19 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Cancelled -
+ Cancelled
@@ -116899,12 +118043,44 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -117040,12 +118216,44 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -117181,12 +118389,44 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -117280,7 +118520,23 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -117293,7 +118549,23 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -117306,7 +118578,23 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -117342,7 +118646,23 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -117352,7 +118672,23 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -117362,7 +118698,23 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -118012,6 +119380,7 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` >
Products refunded
@@ -118028,6 +119397,7 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` >
Cow's milk
@@ -118037,6 +119407,7 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` >
qty: 4
@@ -118053,6 +119424,7 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` >
Goat's milk
@@ -118062,6 +119434,7 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = ` >
qty: 4
@@ -118076,6 +119449,7 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = `
Transaction reference
@@ -118389,20 +119763,19 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -118586,12 +119959,44 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -118768,12 +120173,44 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -118950,12 +120387,44 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -119064,7 +120533,23 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -119077,7 +120562,23 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -119090,7 +120591,23 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -119126,7 +120659,23 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -119136,7 +120685,23 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -119146,7 +120711,23 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -119848,6 +121445,7 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` >
Products refunded
@@ -119864,6 +121462,7 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` >
Cow's milk
@@ -119873,6 +121472,7 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` >
qty: 4
@@ -119889,6 +121489,7 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` >
Goat's milk
@@ -119898,6 +121499,7 @@ exports[`Storyshots Views / Orders / Order details default 1`] = ` >
qty: 4
@@ -119912,6 +121514,7 @@ exports[`Storyshots Views / Orders / Order details default 1`] = `
Transaction reference
@@ -120257,20 +121860,19 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Fulfilled -
+ Fulfilled
@@ -120454,12 +122056,44 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -120636,12 +122270,44 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -120818,12 +122484,44 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -120932,7 +122630,23 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -120945,7 +122659,23 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -120958,7 +122688,23 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -120994,7 +122756,23 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -121004,7 +122782,23 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -121014,7 +122808,23 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -121716,6 +123542,7 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` >
Products refunded
@@ -121732,6 +123559,7 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` >
Cow's milk
@@ -121741,6 +123569,7 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` >
qty: 4
@@ -121757,6 +123586,7 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` >
Goat's milk
@@ -121766,6 +123596,7 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = ` >
qty: 4
@@ -121780,6 +123611,7 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = `
Transaction reference
@@ -122721,20 +124553,19 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -122918,12 +124749,44 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -123100,12 +124963,44 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -123282,12 +125177,44 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -123396,7 +125323,23 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -123409,7 +125352,23 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -123422,7 +125381,23 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -123458,7 +125449,23 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -123468,7 +125475,23 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -123478,7 +125501,23 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -124180,6 +126235,7 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` >
Products refunded
@@ -124196,6 +126252,7 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` >
Cow's milk
@@ -124205,6 +126262,7 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` >
qty: 4
@@ -124221,6 +126279,7 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` >
Goat's milk
@@ -124230,6 +126289,7 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = ` >
qty: 4
@@ -124244,6 +126304,7 @@ exports[`Storyshots Views / Orders / Order details no customer note 1`] = `
Transaction reference
@@ -124589,20 +126650,19 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -124786,12 +126846,44 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -124968,12 +127060,44 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -125150,12 +127274,44 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -125264,7 +127420,23 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -125277,7 +127449,23 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -125290,7 +127478,23 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -125326,7 +127546,23 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -125336,7 +127572,23 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -125346,7 +127598,23 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -126048,6 +128332,7 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` >
Products refunded
@@ -126064,6 +128349,7 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` >
Cow's milk
@@ -126073,6 +128359,7 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` >
qty: 4
@@ -126089,6 +128376,7 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` >
Goat's milk
@@ -126098,6 +128386,7 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = ` >
qty: 4
@@ -126112,6 +128401,7 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = `
Transaction reference
@@ -126457,20 +128747,19 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -126654,12 +128943,44 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -126836,12 +129157,44 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -127018,12 +129371,44 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -127132,7 +129517,23 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -127145,7 +129546,23 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -127158,7 +129575,23 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -127194,7 +129643,23 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -127204,7 +129669,23 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -127214,7 +129695,23 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -127916,6 +130429,7 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` >
Products refunded
@@ -127932,6 +130446,7 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` >
Cow's milk
@@ -127941,6 +130456,7 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` >
qty: 4
@@ -127957,6 +130473,7 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` >
Goat's milk
@@ -127966,6 +130483,7 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = ` >
qty: 4
@@ -127980,6 +130498,7 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = `
Transaction reference
@@ -128325,20 +130844,19 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -128522,12 +131040,44 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -128704,12 +131254,44 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -128886,12 +131468,44 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -129000,7 +131614,23 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -129013,7 +131643,23 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -129026,7 +131672,23 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -129062,7 +131740,23 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -129072,7 +131766,23 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -129082,7 +131792,23 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -129784,6 +132526,7 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` >
Products refunded
@@ -129800,6 +132543,7 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` >
Cow's milk
@@ -129809,6 +132553,7 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` >
qty: 4
@@ -129825,6 +132570,7 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` >
Goat's milk
@@ -129834,6 +132580,7 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = ` >
qty: 4
@@ -129848,6 +132595,7 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = `
Transaction reference
@@ -130193,20 +132941,19 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -130390,12 +133137,44 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -130572,12 +133351,44 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -130754,12 +133565,44 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -130868,7 +133711,23 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -130881,7 +133740,23 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -130894,7 +133769,23 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -130930,7 +133837,23 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -130940,7 +133863,23 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -130950,7 +133889,23 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -131652,6 +134623,7 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` >
Products refunded
@@ -131668,6 +134640,7 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` >
Cow's milk
@@ -131677,6 +134650,7 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` >
qty: 4
@@ -131693,6 +134667,7 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` >
Goat's milk
@@ -131702,6 +134677,7 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = ` >
qty: 4
@@ -131716,6 +134692,7 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = `
Transaction reference
@@ -132061,20 +135038,19 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -132258,12 +135234,44 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -132440,12 +135448,44 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -132622,12 +135662,44 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -132736,7 +135808,23 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -132749,7 +135837,23 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -132762,7 +135866,23 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -132798,7 +135934,23 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -132808,7 +135960,23 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -132818,7 +135986,23 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -133520,6 +136720,7 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` >
Products refunded
@@ -133536,6 +136737,7 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` >
Cow's milk
@@ -133545,6 +136747,7 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` >
qty: 4
@@ -133561,6 +136764,7 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` >
Goat's milk
@@ -133570,6 +136774,7 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = ` >
qty: 4
@@ -133584,6 +136789,7 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = `
Transaction reference
@@ -133929,20 +137135,19 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -134126,12 +137331,44 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -134308,12 +137545,44 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -134490,12 +137759,44 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -134604,7 +137905,23 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -134617,7 +137934,23 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -134630,7 +137963,23 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -134666,7 +138031,23 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -134676,7 +138057,23 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -134686,7 +138083,23 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -135388,6 +138817,7 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` >
Products refunded
@@ -135404,6 +138834,7 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` >
Cow's milk
@@ -135413,6 +138844,7 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` >
qty: 4
@@ -135429,6 +138861,7 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` >
Goat's milk
@@ -135438,6 +138871,7 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = ` >
qty: 4
@@ -135452,6 +138886,7 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = `
Transaction reference
@@ -135797,20 +139232,19 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -135994,12 +139428,44 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -136176,12 +139642,44 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -136358,12 +139856,44 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -136472,7 +140002,23 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -136485,7 +140031,23 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -136498,7 +140060,23 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -136534,7 +140128,23 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -136544,7 +140154,23 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -136554,7 +140180,23 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -137256,6 +140914,7 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` >
Products refunded
@@ -137272,6 +140931,7 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` >
Cow's milk
@@ -137281,6 +140941,7 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` >
qty: 4
@@ -137297,6 +140958,7 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` >
Goat's milk
@@ -137306,6 +140968,7 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = ` >
qty: 4
@@ -137320,6 +140983,7 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = `
Transaction reference
@@ -137665,20 +141329,19 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Partially fulfilled -
+ Partially fulfilled
@@ -137862,12 +141525,44 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -138044,12 +141739,44 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -138226,12 +141953,44 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -138340,7 +142099,23 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -138353,7 +142128,23 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -138366,7 +142157,23 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -138402,7 +142225,23 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -138412,7 +142251,23 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -138422,7 +142277,23 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -139124,6 +143011,7 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` >
Products refunded
@@ -139140,6 +143028,7 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` >
Cow's milk
@@ -139149,6 +143038,7 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` >
qty: 4
@@ -139165,6 +143055,7 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` >
Goat's milk
@@ -139174,6 +143065,7 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = ` >
qty: 4
@@ -139188,6 +143080,7 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = `
Transaction reference
@@ -139533,20 +143426,19 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` class="MuiTypography-root-id PageHeader-title-id MuiTypography-h5-id" >
- #9 + 9
+
-
- Unfulfilled -
+ Unfulfilled
@@ -139730,12 +143622,44 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $18.51 +
+
+ USD +
+
+
+ 18.51 +
+
- $55.53 +
+
+ USD +
+
+
+ 55.53 +
+
@@ -139912,12 +143836,44 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -140094,12 +144050,44 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
- $79.71 +
+
+ USD +
+
+
+ 79.71 +
+
@@ -140208,7 +144196,23 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $214.95 +
+
+ USD +
+
+
+ 214.95 +
+
@@ -140221,7 +144225,23 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -140234,7 +144254,23 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $19.98 +
+
+ USD +
+
+
+ 19.98 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -140270,7 +144322,23 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
@@ -140280,7 +144348,23 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -140290,7 +144374,23 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` - -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
- -$234.93 +
+
+ USD +
+
+
+ -234.93 +
+
@@ -140992,6 +145108,7 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` >
Products refunded
@@ -141008,6 +145125,7 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` >
Cow's milk
@@ -141017,6 +145135,7 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` >
qty: 4
@@ -141033,6 +145152,7 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` >
Goat's milk
@@ -141042,6 +145162,7 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = ` >
qty: 4
@@ -141056,6 +145177,7 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = `
Transaction reference
@@ -141613,13 +145735,45 @@ exports[`Storyshots Views / Orders / Order draft default 1`] = ` - $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
- $336.60 +
+
+ USD +
+
+
+ 336.60 +
+
- $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
- $336.60 +
+
+ USD +
+
+
+ 336.60 +
+
- $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
@@ -141808,7 +146010,23 @@ exports[`Storyshots Views / Orders / Order draft default 1`] = ` - $68.30 +
+
+ USD +
+
+
+ 68.30 +
+
@@ -141818,7 +146036,23 @@ exports[`Storyshots Views / Orders / Order draft default 1`] = ` - $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
@@ -142605,13 +146839,45 @@ exports[`Storyshots Views / Orders / Order draft no user permissions 1`] = ` - $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
- $336.60 +
+
+ USD +
+
+
+ 336.60 +
+
- $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
- $336.60 +
+
+ USD +
+
+
+ 336.60 +
+
- $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
@@ -142800,7 +147114,23 @@ exports[`Storyshots Views / Orders / Order draft no user permissions 1`] = ` - $68.30 +
+
+ USD +
+
+
+ 68.30 +
+
@@ -142810,7 +147140,23 @@ exports[`Storyshots Views / Orders / Order draft no user permissions 1`] = ` - $168.30 +
+
+ USD +
+
+
+ 168.30 +
+
@@ -143877,7 +148223,23 @@ exports[`Storyshots Views / Orders / Order list default 1`] = ` - $305.17 +
+
+ USD +
+
+
+ 305.17 +
+
- $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
- $321.71 +
+
+ USD +
+
+
+ 321.71 +
+
- $271.95 +
+
+ USD +
+
+
+ 271.95 +
+
- $335.84 +
+
+ USD +
+
+
+ 335.84 +
+
- $1,042.15 +
+
+ USD +
+
+
+ 1042.15 +
+
- $213.69 +
+
+ USD +
+
+
+ 213.69 +
+
- $367.03 +
+
+ USD +
+
+
+ 367.03 +
+
- $298.76 +
+
+ USD +
+
+
+ 298.76 +
+
- $663.69 +
+
+ USD +
+
+
+ 663.69 +
+
- $280.41 +
+
+ USD +
+
+
+ 280.41 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
- $485.19 +
+
+ USD +
+
+
+ 485.19 +
+
- $223.54 +
+
+ USD +
+
+
+ 223.54 +
+
- $237.55 +
+
+ USD +
+
+
+ 237.55 +
+
- $453.55 +
+
+ USD +
+
+
+ 453.55 +
+
- $812.67 +
+
+ USD +
+
+
+ 812.67 +
+
- $481.41 +
+
+ USD +
+
+
+ 481.41 +
+
- $569.19 +
+
+ USD +
+
+
+ 569.19 +
+
- $557.00 +
+
+ USD +
+
+
+ 557.00 +
+
@@ -145736,7 +150402,23 @@ exports[`Storyshots Views / Orders / Order list limits reached 1`] = ` - $305.17 +
+
+ USD +
+
+
+ 305.17 +
+
- $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
- $321.71 +
+
+ USD +
+
+
+ 321.71 +
+
- $271.95 +
+
+ USD +
+
+
+ 271.95 +
+
- $335.84 +
+
+ USD +
+
+
+ 335.84 +
+
- $1,042.15 +
+
+ USD +
+
+
+ 1042.15 +
+
- $213.69 +
+
+ USD +
+
+
+ 213.69 +
+
- $367.03 +
+
+ USD +
+
+
+ 367.03 +
+
- $298.76 +
+
+ USD +
+
+
+ 298.76 +
+
- $663.69 +
+
+ USD +
+
+
+ 663.69 +
+
- $280.41 +
+
+ USD +
+
+
+ 280.41 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
- $485.19 +
+
+ USD +
+
+
+ 485.19 +
+
- $223.54 +
+
+ USD +
+
+
+ 223.54 +
+
- $237.55 +
+
+ USD +
+
+
+ 237.55 +
+
- $453.55 +
+
+ USD +
+
+
+ 453.55 +
+
- $812.67 +
+
+ USD +
+
+
+ 812.67 +
+
- $481.41 +
+
+ USD +
+
+
+ 481.41 +
+
- $569.19 +
+
+ USD +
+
+
+ 569.19 +
+
- $557.00 +
+
+ USD +
+
+
+ 557.00 +
+
@@ -148006,7 +152992,23 @@ exports[`Storyshots Views / Orders / Order list no limits 1`] = ` - $305.17 +
+
+ USD +
+
+
+ 305.17 +
+
- $1,215.89 +
+
+ USD +
+
+
+ 1215.89 +
+
- $321.71 +
+
+ USD +
+
+
+ 321.71 +
+
- $271.95 +
+
+ USD +
+
+
+ 271.95 +
+
- $335.84 +
+
+ USD +
+
+
+ 335.84 +
+
- $1,042.15 +
+
+ USD +
+
+
+ 1042.15 +
+
- $213.69 +
+
+ USD +
+
+
+ 213.69 +
+
- $367.03 +
+
+ USD +
+
+
+ 367.03 +
+
- $298.76 +
+
+ USD +
+
+
+ 298.76 +
+
- $663.69 +
+
+ USD +
+
+
+ 663.69 +
+
- $280.41 +
+
+ USD +
+
+
+ 280.41 +
+
- $234.93 +
+
+ USD +
+
+
+ 234.93 +
+
- $485.19 +
+
+ USD +
+
+
+ 485.19 +
+
- $223.54 +
+
+ USD +
+
+
+ 223.54 +
+
- $237.55 +
+
+ USD +
+
+
+ 237.55 +
+
- $453.55 +
+
+ USD +
+
+
+ 453.55 +
+
- $812.67 +
+
+ USD +
+
+
+ 812.67 +
+
- $481.41 +
+
+ USD +
+
+
+ 481.41 +
+
- $569.19 +
+
+ USD +
+
+
+ 569.19 +
+
- $557.00 +
+
+ USD +
+
+
+ 557.00 +
+
@@ -150548,7 +155854,23 @@ exports[`Storyshots Views / Orders / Refund order miscellaneous 1`] = ` > Authorized Amount
- $744.38 +
+
+ USD +
+
+
+ 744.38 +
+
Previously refunded
- -$100.00 +
+
+ USD +
+
+
+ -100.00 +
+
Max Refund
- $644.38 +
+
+ USD +
+
+
+ 644.38 +
+
@@ -150911,7 +156265,23 @@ exports[`Storyshots Views / Orders / Refund order products 1`] = ` - $26.02 +
+
+ USD +
+
+
+ 26.02 +
+
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
- $10.00 +
+
+ USD +
+
+
+ 10.00 +
+
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -151154,7 +156572,23 @@ exports[`Storyshots Views / Orders / Refund order products 1`] = ` - $26.02 +
+
+ USD +
+
+
+ 26.02 +
+
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
- $10.00 +
+
+ USD +
+
+
+ 10.00 +
+
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -151397,7 +156879,23 @@ exports[`Storyshots Views / Orders / Refund order products 1`] = ` - $26.02 +
+
+ USD +
+
+
+ 26.02 +
+
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
- $10.00 +
+
+ USD +
+
+
+ 10.00 +
+
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
@@ -151652,7 +157198,23 @@ exports[`Storyshots Views / Orders / Refund order products 1`] = ` > Authorized Amount
- $744.38 +
+
+ USD +
+
+
+ 744.38 +
+
Selected Products Value
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
Previously refunded
- -$100.00 +
+
+ USD +
+
+
+ -100.00 +
+
Max Refund
- $644.38 +
+
+ USD +
+
+
+ 644.38 +
+
Refund total amount
- $0.00 +
+
+ USD +
+
+
+ 0.00 +
+
diff --git a/src/types.ts b/src/types.ts index d8f622864..ae1c4b8ad 100644 --- a/src/types.ts +++ b/src/types.ts @@ -42,7 +42,8 @@ export enum ListViews { VOUCHER_LIST = "VOUCHER_LIST", WAREHOUSE_LIST = "WAREHOUSE_LIST", WEBHOOK_LIST = "WEBHOOK_LIST", - TRANSLATION_ATTRIBUTE_VALUE_LIST = "TRANSLATION_ATTRIBUTE_VALUE_LIST" + TRANSLATION_ATTRIBUTE_VALUE_LIST = "TRANSLATION_ATTRIBUTE_VALUE_LIST", + GIFT_CARD_LIST = " GIFT_CARD_LIST" } export interface ListProps { @@ -139,6 +140,10 @@ export interface SlugNode { slug: string; } +export interface TagNode { + tag: string; +} + export type Pagination = Partial<{ after: string; before: string; diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index 634a99718..a39dc4aa1 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -468,6 +468,33 @@ export enum FulfillmentStatus { RETURNED = "RETURNED", } +export enum GiftCardErrorCode { + ALREADY_EXISTS = "ALREADY_EXISTS", + GRAPHQL_ERROR = "GRAPHQL_ERROR", + INVALID = "INVALID", + NOT_FOUND = "NOT_FOUND", + REQUIRED = "REQUIRED", + UNIQUE = "UNIQUE", +} + +export enum GiftCardEventsEnum { + ACTIVATED = "ACTIVATED", + BALANCE_RESET = "BALANCE_RESET", + BOUGHT = "BOUGHT", + DEACTIVATED = "DEACTIVATED", + EXPIRY_SETTINGS_UPDATED = "EXPIRY_SETTINGS_UPDATED", + ISSUED = "ISSUED", + RESENT = "RESENT", + SENT_TO_CUSTOMER = "SENT_TO_CUSTOMER", + UPDATED = "UPDATED", +} + +export enum GiftCardExpiryTypeEnum { + EXPIRY_DATE = "EXPIRY_DATE", + EXPIRY_PERIOD = "EXPIRY_PERIOD", + NEVER_EXPIRE = "NEVER_EXPIRE", +} + export enum InvoiceErrorCode { EMAIL_NOT_SET = "EMAIL_NOT_SET", INVALID_STATUS = "INVALID_STATUS", @@ -957,6 +984,12 @@ export enum StockErrorCode { UNIQUE = "UNIQUE", } +export enum TimePeriodTypeEnum { + DAY = "DAY", + MONTH = "MONTH", + YEAR = "YEAR", +} + export enum UploadErrorCode { GRAPHQL_ERROR = "GRAPHQL_ERROR", } @@ -1363,6 +1396,31 @@ export interface FulfillmentUpdateTrackingInput { notifyCustomer?: boolean | null; } +export interface GiftCardCreateInput { + tag?: string | null; + startDate?: any | null; + endDate?: any | null; + balance: PriceInput; + userEmail?: string | null; + expirySettings: GiftCardExpirySettingsInput; + code?: string | null; + note?: string | null; +} + +export interface GiftCardExpirySettingsInput { + expiryType: GiftCardExpiryTypeEnum; + expiryDate?: any | null; + expiryPeriod?: TimePeriodInputType | null; +} + +export interface GiftCardUpdateInput { + tag?: string | null; + startDate?: any | null; + endDate?: any | null; + balanceAmount?: any | null; + expirySettings?: GiftCardExpirySettingsInput | null; +} + export interface IntRangeInput { gte?: number | null; lte?: number | null; @@ -1631,6 +1689,11 @@ export interface PluginUpdateInput { configuration?: (ConfigurationItemInput | null)[] | null; } +export interface PriceInput { + currency: string; + amount: any; +} + export interface PriceRangeInput { gte?: number | null; lte?: number | null; @@ -1938,6 +2001,11 @@ export interface StockInput { quantity: number; } +export interface TimePeriodInputType { + amount: number; + type: TimePeriodTypeEnum; +} + export interface TranslationInput { seoTitle?: string | null; seoDescription?: string | null; diff --git a/src/utils/errors/index.ts b/src/utils/errors/index.ts index 223c2e132..14ba98ae4 100644 --- a/src/utils/errors/index.ts +++ b/src/utils/errors/index.ts @@ -15,7 +15,7 @@ export function getErrors(errors: UserError[]): string[] { export function getFormErrors( fields: TField[], - errors: TError[] + errors: TError[] = [] ): Record { return fields.reduce((errs, field) => { errs[field] = getFieldError(errors, field); diff --git a/src/utils/handlers/dialogActionHandlers.ts b/src/utils/handlers/dialogActionHandlers.ts index 6b4e6a87b..03192efa1 100644 --- a/src/utils/handlers/dialogActionHandlers.ts +++ b/src/utils/handlers/dialogActionHandlers.ts @@ -7,6 +7,11 @@ type CreateCloseModal< TParams extends Dialog > = [(action: TAction, newParams?: TParams) => void, () => void]; +export interface DialogActionHandlers { + onClose: () => void; + open: boolean; +} + function createDialogActionHandlers< TAction extends string, TParams extends Dialog & BulkAction & SingleAction diff --git a/src/utils/handlers/singleAutocompleteSelectChangeHandler.ts b/src/utils/handlers/singleAutocompleteSelectChangeHandler.ts index d3c718e6a..322b33aae 100644 --- a/src/utils/handlers/singleAutocompleteSelectChangeHandler.ts +++ b/src/utils/handlers/singleAutocompleteSelectChangeHandler.ts @@ -1,6 +1,12 @@ import { SingleAutocompleteChoiceType } from "@saleor/components/SingleAutocompleteSelectField"; import { FormChange } from "@saleor/hooks/useForm"; +export interface SingleAutocompleteSelectedChangeHandlerProps { + change: FormChange; + setSelected: (value: string) => void; + choices: SingleAutocompleteChoiceType[]; +} + function createSingleAutocompleteSelectHandler( change: FormChange, setSelected: (value: string) => void, diff --git a/src/utils/maps.ts b/src/utils/maps.ts index 85c2f4bc7..825796bb4 100644 --- a/src/utils/maps.ts +++ b/src/utils/maps.ts @@ -5,7 +5,7 @@ import { } from "@saleor/components/SingleAutocompleteSelectField"; import { MetadataItem } from "@saleor/fragments/types/MetadataItem"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; -import { Node, SlugNode } from "@saleor/types"; +import { Node, SlugNode, TagNode } from "@saleor/types"; import { MetadataInput } from "@saleor/types/globalTypes"; interface Edge { @@ -36,13 +36,14 @@ export function mapPagesToChoices(pages: SearchPages_search_edges_node[]) { } type ExtendedNode = Node & Record<"name", string>; + export function mapNodeToChoice( nodes: T[] ): Array>; -export function mapNodeToChoice( - nodes: T[], - getterFn: (node: T) => K -): Array>; +export function mapNodeToChoice< + T extends ExtendedNode | Node, + K extends ChoiceValue +>(nodes: T[], getterFn: (node: T) => K): Array>; export function mapNodeToChoice( nodes: T[], getterFn?: (node: T) => any @@ -60,7 +61,13 @@ export function mapNodeToChoice( export function mapSlugNodeToChoice( nodes: Array ): SingleAutocompleteChoiceType[] { - return mapNodeToChoice(nodes, nodes => nodes.slug); + return mapNodeToChoice(nodes, node => node.slug); +} + +export function mapTagNodeToChoice( + nodes: Array +): SingleAutocompleteChoiceType[] { + return mapNodeToChoice(nodes, node => node.tag); } export function mapMetadataItemToInput(item: MetadataItem): MetadataInput { @@ -69,3 +76,18 @@ export function mapMetadataItemToInput(item: MetadataItem): MetadataInput { value: item.value }; } + +export function mapSingleValueNodeToChoice>( + nodes: T[] | string[], + key?: keyof T +): SingleAutocompleteChoiceType[] { + if (!nodes) { + return []; + } + + if ((nodes as string[]).every(node => typeof node === "string")) { + return (nodes as string[]).map(node => ({ label: node, value: node })); + } + + return (nodes as T[]).map(node => ({ label: node[key], value: node[key] })); +} diff --git a/src/utils/metadata/types/UpdateMetadata.ts b/src/utils/metadata/types/UpdateMetadata.ts index b6ec48547..5d016e59e 100644 --- a/src/utils/metadata/types/UpdateMetadata.ts +++ b/src/utils/metadata/types/UpdateMetadata.ts @@ -39,7 +39,7 @@ export interface UpdateMetadata_deleteMetadata_item_privateMetadata { } export interface UpdateMetadata_deleteMetadata_item { - __typename: "App" | "Warehouse" | "ShippingZone" | "ShippingMethod" | "Product" | "ProductType" | "Attribute" | "Category" | "ProductVariant" | "DigitalContent" | "Collection" | "Page" | "PageType" | "Sale" | "Voucher" | "MenuItem" | "Menu" | "User" | "Checkout" | "Order" | "Fulfillment" | "Invoice"; + __typename: "App" | "Warehouse" | "ShippingZone" | "ShippingMethod" | "Product" | "ProductType" | "Attribute" | "Category" | "ProductVariant" | "DigitalContent" | "Collection" | "Page" | "PageType" | "Sale" | "Voucher" | "MenuItem" | "Menu" | "User" | "Checkout" | "GiftCard" | "Order" | "Fulfillment" | "Invoice"; metadata: (UpdateMetadata_deleteMetadata_item_metadata | null)[]; privateMetadata: (UpdateMetadata_deleteMetadata_item_privateMetadata | null)[]; id: string; diff --git a/src/utils/metadata/types/UpdatePrivateMetadata.ts b/src/utils/metadata/types/UpdatePrivateMetadata.ts index 0a3ae8363..ce8d6e8b7 100644 --- a/src/utils/metadata/types/UpdatePrivateMetadata.ts +++ b/src/utils/metadata/types/UpdatePrivateMetadata.ts @@ -39,7 +39,7 @@ export interface UpdatePrivateMetadata_deletePrivateMetadata_item_privateMetadat } export interface UpdatePrivateMetadata_deletePrivateMetadata_item { - __typename: "App" | "Warehouse" | "ShippingZone" | "ShippingMethod" | "Product" | "ProductType" | "Attribute" | "Category" | "ProductVariant" | "DigitalContent" | "Collection" | "Page" | "PageType" | "Sale" | "Voucher" | "MenuItem" | "Menu" | "User" | "Checkout" | "Order" | "Fulfillment" | "Invoice"; + __typename: "App" | "Warehouse" | "ShippingZone" | "ShippingMethod" | "Product" | "ProductType" | "Attribute" | "Category" | "ProductVariant" | "DigitalContent" | "Collection" | "Page" | "PageType" | "Sale" | "Voucher" | "MenuItem" | "Menu" | "User" | "Checkout" | "GiftCard" | "Order" | "Fulfillment" | "Invoice"; metadata: (UpdatePrivateMetadata_deletePrivateMetadata_item_metadata | null)[]; privateMetadata: (UpdatePrivateMetadata_deletePrivateMetadata_item_privateMetadata | null)[]; id: string;