Skip to content

Commit

Permalink
Bring in latest unstable changes from checkout (#1145)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonmade committed Jul 25, 2023
1 parent 6aba308 commit 2d147ef
Show file tree
Hide file tree
Showing 394 changed files with 7,666 additions and 3,110 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-sheep-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions-react': patch
---

Allow passing target name to `useApi()` for type inference
5 changes: 5 additions & 0 deletions .changeset/neat-vans-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions': minor
---

Add `Extension.target` field for checkout UI extensions to read the current extension target being rendered.
5 changes: 5 additions & 0 deletions .changeset/odd-craps-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions-react': minor
---

Make `@shopify/ui-extensions` a peer dependency for the React library
5 changes: 5 additions & 0 deletions .changeset/pink-poets-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions': patch
---

Preserve generic type argument for `I18nTranslate` function
5 changes: 5 additions & 0 deletions .changeset/slimy-timers-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions-react': patch
---

Allow React extensions to return asynchronous results
6 changes: 6 additions & 0 deletions .changeset/smart-actors-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/ui-extensions': minor
'@shopify/ui-extensions-react': minor
---

Add `customer-account` entrypoints for order status page extensions
5 changes: 5 additions & 0 deletions .changeset/thin-wasps-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions': major
---

Update API type names to match new extension target names
6 changes: 6 additions & 0 deletions .changeset/unlucky-papayas-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/ui-extensions': minor
'@shopify/ui-extensions-react': minor
---

Add support for new extension target names
4 changes: 3 additions & 1 deletion packages/ui-extensions-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import {
TextField,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension('Checkout::Dynamic::Render', () => <GiftNote />);
export default reactExtension('purchase.checkout.block.render', () => (
<GiftNote />
));

function GiftNote() {
const {i18n, metafields, applyMetafieldChange} = useApi();
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-extensions-react/src/surfaces/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export type {
DisclosureActivatorProps,
DisclosureOpen,
DisabledDate,
ExtensionPoint,
ExtensionPoints,
ExtensionTarget,
ExtensionTargets,
Fit,
GridItemSize,
I18nTranslate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {reactExtension, Banner} from '@shopify/ui-extensions-react/checkout';
import {
reactExtension,
Banner,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
View,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
View,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
View,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {reactExtension, Button} from '@shopify/ui-extensions-react/checkout';
import {
reactExtension,
Button,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {reactExtension, Checkbox} from '@shopify/ui-extensions-react/checkout';
import {
reactExtension,
Checkbox,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
InlineStack,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand All @@ -15,7 +18,9 @@ function Extension() {
name="choice"
value="first"
onChange={(value) => {
console.log(`onChange event with value: ${value}`);
console.log(
`onChange event with value: ${value}`,
);
}}
>
<BlockStack>
Expand All @@ -28,12 +33,18 @@ function Extension() {
name="choiceMultiple"
value={['multipleFirst']}
onChange={(value) => {
console.log(`onChange event with value: ${value}`);
console.log(
`onChange event with value: ${value}`,
);
}}
>
<BlockStack>
<Choice id="multipleFirst">Gift message</Choice>
<Choice id="multipleSecond">Gift wrapping</Choice>
<Choice id="multipleFirst">
Gift message
</Choice>
<Choice id="multipleSecond">
Gift wrapping
</Choice>
</BlockStack>
</ChoiceList>
</InlineStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
InlineStack,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand All @@ -15,7 +18,9 @@ function Extension() {
name="choice"
value="first"
onChange={(value) => {
console.log(`onChange event with value: ${value}`);
console.log(
`onChange event with value: ${value}`,
);
}}
>
<BlockStack>
Expand All @@ -28,12 +33,18 @@ function Extension() {
name="choiceMultiple"
value={['multipleFirst']}
onChange={(value) => {
console.log(`onChange event with value: ${value}`);
console.log(
`onChange event with value: ${value}`,
);
}}
>
<BlockStack>
<Choice id="multipleFirst">Gift message</Choice>
<Choice id="multipleSecond">Gift wrapping</Choice>
<Choice id="multipleFirst">
Gift message
</Choice>
<Choice id="multipleSecond">
Gift wrapping
</Choice>
</BlockStack>
</ChoiceList>
</InlineStack>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {reactExtension, DateField} from '@shopify/ui-extensions-react/checkout';
import {
reactExtension,
DateField,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <DateField label="Select a date" />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import {
DatePicker,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <DatePicker selected="2021-06-01" />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
View,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {reactExtension, Divider} from '@shopify/ui-extensions-react/checkout';
import {
reactExtension,
Divider,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Divider />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ import {
View,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
<Form onSubmit={() => console.log('onSubmit event')}>
<Grid columns={['50%', '50%']} spacing="base">
<Form
onSubmit={() =>
console.log('onSubmit event')
}
>
<Grid
columns={['50%', '50%']}
spacing="base"
>
<View>
<TextField label="First name" />
</View>
Expand All @@ -26,7 +36,9 @@ function Extension() {
</GridItem>
</Grid>
<BlockSpacer spacing="base" />
<Button accessibilityRole="submit">Submit</Button>
<Button accessibilityRole="submit">
Submit
</Button>
</Form>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
View,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
View,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {reactExtension, Heading} from '@shopify/ui-extensions-react/checkout';
import {
reactExtension,
Heading,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Heading>Store name</Heading>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
Heading,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {reactExtension, Icon} from '@shopify/ui-extensions-react/checkout';
import {
reactExtension,
Icon,
} from '@shopify/ui-extensions-react/checkout';

reactExtension('Checkout::Dynamic::Render', () => <Extension />);
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Icon source="discount" />;
Expand Down
Loading

0 comments on commit 2d147ef

Please sign in to comment.