From 5990de07d52e2e232a569d7e8181bc903f5af98f Mon Sep 17 00:00:00 2001 From: Mathius Date: Tue, 28 Nov 2023 14:05:46 -0800 Subject: [PATCH] fix: move DiscountApplicationStrategy to constants --- .changeset/ninety-tables-grin.md | 5 +++++ .../DiscountApplicationStrategyCard.tsx | 4 ++-- .../tests/DiscountApplicationStrategyCard.test.tsx | 3 +-- src/constants.ts | 6 ++++++ src/index.ts | 2 +- src/types.ts | 5 ----- 6 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .changeset/ninety-tables-grin.md diff --git a/.changeset/ninety-tables-grin.md b/.changeset/ninety-tables-grin.md new file mode 100644 index 00000000..03723f4e --- /dev/null +++ b/.changeset/ninety-tables-grin.md @@ -0,0 +1,5 @@ +--- +'@shopify/discount-app-components': patch +--- + +move strategy to constants diff --git a/src/components/DiscountApplicationStrategyCard/DiscountApplicationStrategyCard.tsx b/src/components/DiscountApplicationStrategyCard/DiscountApplicationStrategyCard.tsx index e8db56fc..55f96854 100644 --- a/src/components/DiscountApplicationStrategyCard/DiscountApplicationStrategyCard.tsx +++ b/src/components/DiscountApplicationStrategyCard/DiscountApplicationStrategyCard.tsx @@ -2,8 +2,8 @@ import React from 'react'; import {Box, Card, ChoiceList, Text, BlockStack} from '@shopify/polaris'; import {useI18n} from '@shopify/react-i18n'; -import {DiscountApplicationStrategy, Field} from '../../types'; -import {DiscountClass} from '../../constants'; +import {Field} from '../../types'; +import {DiscountClass, DiscountApplicationStrategy} from '../../constants'; export interface DiscountAppStrategyProps { /** diff --git a/src/components/DiscountApplicationStrategyCard/tests/DiscountApplicationStrategyCard.test.tsx b/src/components/DiscountApplicationStrategyCard/tests/DiscountApplicationStrategyCard.test.tsx index cdbea170..ade27d70 100644 --- a/src/components/DiscountApplicationStrategyCard/tests/DiscountApplicationStrategyCard.test.tsx +++ b/src/components/DiscountApplicationStrategyCard/tests/DiscountApplicationStrategyCard.test.tsx @@ -3,8 +3,7 @@ import {ChoiceList, TextField} from '@shopify/polaris'; import {mockField, mountWithApp} from 'tests/utilities'; import {DiscountApplicationStrategyCard} from '../DiscountApplicationStrategyCard'; -import {DiscountApplicationStrategy} from '../../../types'; -import {DiscountClass} from '../../../constants'; +import {DiscountClass, DiscountApplicationStrategy} from '../../../constants'; describe('', () => { const mockProps = { diff --git a/src/constants.ts b/src/constants.ts index ec8cc353..d73aeed8 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -323,3 +323,9 @@ export enum DiscountValueType { Percentage = 'PERCENTAGE', FixedAmount = 'FIXED_AMOUNT', } + +export enum DiscountApplicationStrategy { + First = 'FIRST', + Maximum = 'MAXIMUM', + All = 'ALL', +} diff --git a/src/index.ts b/src/index.ts index 985a195d..435cf3da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,6 @@ export type { CustomerSegment, CombinableDiscountTypes, CombinableDiscountCounts, - DiscountApplicationStrategy, } from './types'; // constants @@ -32,6 +31,7 @@ export { DiscountStatus, Eligibility, PurchaseType, + DiscountApplicationStrategy, } from './constants'; // provider diff --git a/src/types.ts b/src/types.ts index ee99b3c9..8aa1f2ed 100644 --- a/src/types.ts +++ b/src/types.ts @@ -84,11 +84,6 @@ export interface CombinableDiscountCounts { export type CountryCode = SupportedCountryCode | typeof REST_OF_WORLD; -export enum DiscountApplicationStrategy { - First = 'FIRST', - Maximum = 'MAXIMUM', - All = 'ALL', -} export interface ProductOrCollectionResource extends Resource { title: string; }