Skip to content

Commit f15dfdf

Browse files
authored
[ui-extensions]: Changes from checkout-web (#2840)
* changes from checkout-web build docs script lint type check type check updated files lint * remove not ready components
1 parent ef4e45b commit f15dfdf

File tree

371 files changed

+1094
-6466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

371 files changed

+1094
-6466
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
'packages/*/*.node',
1818
'packages/*/*.esnext',
1919
'packages/ui-extensions/src/surfaces/checkout/**/*.d.ts',
20+
'packages/ui-extensions/src/surfaces/checkout/preact/tests/',
2021
],
2122
rules: {
2223
// Codebase was originally written without some strict Shopify conventions

packages/ui-extensions/docs/surfaces/checkout/build-docs.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
API_VERSION=$1
22
DOCS_PATH=docs/surfaces/checkout
33
SRC_PATH=src/surfaces/checkout
4+
COMPONENTS_DEFINITIONS=src/surfaces/checkout/components/components.d.ts
5+
COMPONENTS_TS=src/surfaces/checkout/components/components.ts
46

57
fail_and_exit() {
68
echo "** Failed to generate docs"
@@ -11,10 +13,10 @@ fail_and_exit() {
1113
run_sed() {
1214
if [[ "$OSTYPE" == "darwin"* ]]; then
1315
# macOS
14-
sed -i '' "$1" "$2"
16+
sed -Ei '' "$1" "$2"
1517
else
1618
# Linux and other Unix-like systems
17-
sed -i "$1" "$2"
19+
sed -ri "$1" "$2"
1820
fi
1921
}
2022

@@ -31,9 +33,11 @@ else
3133
echo "Building docs for '$API_VERSION' checkout UI extensions API."
3234
fi
3335

34-
COMPILE_DOCS="yarn tsc --project $DOCS_PATH/tsconfig.docs.json --types react --moduleResolution node --target esNext --module CommonJS && yarn generate-docs --overridePath ./$DOCS_PATH/typeOverride.json --input ./$DOCS_PATH/reference ./$SRC_PATH --typesInput ./$SRC_PATH --output ./$DOCS_PATH/generated"
36+
COMPILE_DOCS="yarn tsc --project $DOCS_PATH/tsconfig.docs.json --types react --moduleResolution node --target esNext --module CommonJS && yarn generate-docs --overridePath ./$DOCS_PATH/typeOverride.json --input ./$DOCS_PATH/reference ./$SRC_PATH --typesInput ./$SRC_PATH --output ./$DOCS_PATH/generated"
3537
COMPILE_STATIC_PAGES="yarn tsc $DOCS_PATH/staticPages/*.doc.ts --types react --moduleResolution node --target esNext --module CommonJS && yarn generate-docs --isLandingPage --input ./$DOCS_PATH/staticPages --output ./$DOCS_PATH/generated"
3638

39+
# Rename components.d.ts to components.ts so it can be picked up be the generate-docs tool
40+
cp $COMPONENTS_DEFINITIONS $COMPONENTS_TS
3741

3842
if echo "$PWD" | grep -q '\checkout-web'; then
3943
# We are generating docs from the private package, which does not have other surfaces aside from checkout
@@ -44,10 +48,12 @@ else
4448
# so we erase their contents and replace them afterwards
4549
echo "export {}" > src/surfaces/customer-account.ts
4650
echo "export {}" > src/surfaces/admin.ts
51+
echo "export {}" > src/surfaces/point-of-sale.ts
4752
eval $COMPILE_DOCS && eval $COMPILE_STATIC_PAGES
4853
build_exit=$?
4954
git checkout HEAD -- src/surfaces/customer-account.ts
5055
git checkout HEAD -- src/surfaces/admin.ts
56+
git checkout HEAD -- src/surfaces/point-of-sale.ts
5157
fi
5258

5359
# TODO: get generate-docs to stop requiring JS files:
@@ -66,6 +72,21 @@ if [ $sed_exit -ne 0 ]; then
6672
fail_and_exit $sed_exit
6773
fi
6874

75+
echo
76+
if [ $API_VERSION == "2025-10-rc" ]
77+
then
78+
echo "**** ${API_VERSION}: prefixing generate commands with POLARIS_UNIFIED=true"
79+
run_sed 's/(npm run shopify app generate extension)/POLARIS_UNIFIED=true \1/gi' \
80+
./$DOCS_PATH/generated/generated_static_pages.json
81+
run_sed 's/(pnpm shopify app generate extension)/POLARIS_UNIFIED=true \1/gi' \
82+
./$DOCS_PATH/generated/generated_static_pages.json
83+
run_sed 's/(yarn shopify app generate extension)/POLARIS_UNIFIED=true \1/gi' \
84+
./$DOCS_PATH/generated/generated_static_pages.json
85+
else
86+
echo "**** ${API_VERSION}: NOT prefixing generate commands with POLARIS_UNIFIED=true"
87+
fi
88+
echo
89+
6990

7091

7192
copy_generated_docs_to_shopify_dev() {
@@ -99,7 +120,7 @@ SHOPIFY_DEV_PATH="../../../shopify-dev"
99120
if [ -d $SHOPIFY_DEV_PATH ]; then
100121
copy_generated_docs_to_shopify_dev
101122
else
102-
# We could be in the shop/world repo and its in a different location on your local machine
123+
# We could be in the shop/world repo and it's in a different location on your local machine
103124
# This is a best guess as to where it might be located in local dev environments
104125
SHOPIFY_DEV_PATH="$HOME/src/github.com/Shopify/shopify-dev"
105126
copy_generated_docs_to_shopify_dev

packages/ui-extensions/docs/surfaces/checkout/reference/apis/analytics.doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const data: ReferenceEntityTemplateSchema = {
1919
type: 'Docs_Standard_AnalyticsApi',
2020
},
2121
],
22-
defaultExample: getExample('analytics-publish', ['jsx', 'js']),
22+
defaultExample: getExample('analytics-publish', ['jsx']),
2323
examples: {
2424
description: '',
25-
examples: [getExample('analytics-visitor', ['jsx', 'js'])],
25+
examples: [getExample('analytics-visitor', ['jsx'])],
2626
},
2727
related: getLinksByTag('apis'),
2828
};

packages/ui-extensions/docs/surfaces/checkout/reference/apis/attributes.doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ const data: ReferenceEntityTemplateSchema = {
4343
type: 'UseAttributeValuesGeneratedType',
4444
},
4545
],
46-
defaultExample: getExample('attribute-values', ['jsx', 'js']),
46+
defaultExample: getExample('attribute-values', ['jsx']),
4747
examples: {
4848
description: '',
49-
examples: [getExample('attributes/attribute-change', ['jsx', 'js'])],
49+
examples: [getExample('attributes/attribute-change', ['jsx'])],
5050
},
5151
related: getLinksByTag('apis'),
5252
};

packages/ui-extensions/docs/surfaces/checkout/reference/apis/buyer-journey.doc.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,13 @@ const data: ReferenceEntityTemplateSchema = {
5959
],
6060
defaultExample: getExample('buyer-journey-intercept/target-native-field', [
6161
'jsx',
62-
'js',
6362
]),
6463
examples: {
6564
description:
6665
'In addition to targeting checkout UI fields, you can also pass errors to the page level or render the error in your extension.',
6766
examples: [
68-
getExample('buyer-journey-intercept/page-level-error', ['jsx', 'js']),
69-
getExample('buyer-journey-intercept/extension-banner', ['jsx', 'js']),
67+
getExample('buyer-journey-intercept/page-level-error', ['jsx']),
68+
getExample('buyer-journey-intercept/extension-banner', ['jsx']),
7069
],
7170
},
7271
related: [

packages/ui-extensions/docs/surfaces/checkout/reference/apis/cart-instructions.doc.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ const data: ReferenceEntityTemplateSchema = {
2525
type: 'UseInstructionsGeneratedType',
2626
},
2727
],
28-
defaultExample: getExample('cart-instructions/discounts', ['jsx', 'js']),
28+
defaultExample: getExample('cart-instructions/discounts', ['jsx']),
2929
examples: {
3030
description:
3131
'Use the cart instructions API to determine if the affected APIs are available in checkout.',
3232
examples: [
33-
getExample('cart-instructions/attributes', ['jsx', 'js']),
34-
getExample('cart-instructions/delivery', ['jsx', 'js']),
35-
getExample('cart-instructions/discounts', ['jsx', 'js']),
36-
getExample('cart-instructions/cart-lines-add', ['jsx', 'js']),
37-
getExample('cart-instructions/metafields', ['jsx', 'js']),
38-
getExample('cart-instructions/notes', ['jsx', 'js']),
33+
getExample('cart-instructions/attributes', ['jsx']),
34+
getExample('cart-instructions/delivery', ['jsx']),
35+
getExample('cart-instructions/discounts', ['jsx']),
36+
getExample('cart-instructions/cart-lines-add', ['jsx']),
37+
getExample('cart-instructions/metafields', ['jsx']),
38+
getExample('cart-instructions/notes', ['jsx']),
3939
],
4040
},
4141
related: getLinksByTag('apis'),

packages/ui-extensions/docs/surfaces/checkout/reference/apis/cart-lines.doc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const data: ReferenceEntityTemplateSchema = {
5555
type: 'UseCartLineTargetGeneratedType',
5656
},
5757
],
58-
defaultExample: getExample('cart-line-item/default', ['jsx', 'js']),
58+
defaultExample: getExample('cart-line-item/default', ['jsx']),
5959
related: getLinksByTag('apis'),
6060
};
6161

packages/ui-extensions/docs/surfaces/checkout/reference/apis/cost.doc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const data: ReferenceEntityTemplateSchema = {
3838
{
3939
title: 'useTotalAmount',
4040
description:
41-
'Returns a `Money` value representing the minimum a buyer can expect to pay at the current step of checkout. This value excludes amounts yet to be negotiated. For example, the information step might not have delivery costs calculated.',
41+
'Returns a `Money` value representing the minimum a buyer can expect to pay at the current step of checkout. This value excludes amounts yet to be negotiated. For example, the information step might not have delivery costs calculated. Applied gift cards and store credit are excluded.',
4242
type: 'UseTotalAmountGeneratedType',
4343
},
4444
],

packages/ui-extensions/docs/surfaces/checkout/reference/apis/customer-privacy.doc.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,7 @@ const data: ReferenceEntityTemplateSchema = {
3030
type: 'UseCustomerPrivacyGeneratedType',
3131
},
3232
],
33-
defaultExample: getExample('customer-privacy/default', ['jsx', 'js']),
34-
examples: {
35-
description: '',
36-
examples: [
37-
getExample('customer-privacy/sheet-consent-banner-with-form', [
38-
'jsx',
39-
'js',
40-
]),
41-
],
42-
},
33+
defaultExample: getExample('customer-privacy/default', ['jsx']),
4334
related: getLinksByTag('apis'),
4435
};
4536

packages/ui-extensions/docs/surfaces/checkout/reference/apis/delivery.doc.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ const data: ReferenceEntityTemplateSchema = {
103103
description:
104104
'Learn how to use the API with JavaScript (JS) and React. See [React Hooks](../react-hooks) for all available hooks.',
105105
examples: [
106-
getExample('shipping-option-item/default', ['jsx', 'js']),
106+
getExample('shipping-option-item/default', ['jsx']),
107107
getExample(
108108
'purchase.checkout.pickup-location-option-item.render-after/default',
109-
['jsx', 'js'],
109+
['jsx'],
110110
),
111-
getExample('pickup-point-list/default', ['jsx', 'js']),
111+
getExample('pickup-point-list/default', ['jsx']),
112112
getHookExample('delivery-groups'),
113113
],
114114
},

0 commit comments

Comments
 (0)