Skip to content

Commit 94b53fa

Browse files
committed
Update delivery customizations examples to use renamed targets
1 parent dcebf24 commit 94b53fa

File tree

15 files changed

+3235
-832
lines changed

15 files changed

+3235
-832
lines changed

checkout/javascript/delivery-customization/default/schema.graphql

+673-215
Large diffs are not rendered by default.

checkout/javascript/delivery-customization/default/shopify.extension.toml.liquid

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
api_version = "2025-01"
1+
api_version = "2025-07"
22

33
[[extensions]]
44
name = "t:name"
@@ -8,7 +8,7 @@ type = "function"
88
description = "t:description"
99

1010
[[extensions.targeting]]
11-
target = "purchase.delivery-customization.run"
11+
target = "cart.delivery-options.transform.run"
1212
input_query = "src/run.graphql"
1313
export = "run"
1414

checkout/javascript/delivery-customization/default/src/run.liquid

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
/**
55
* @typedef {import("../generated/api").RunInput} RunInput
6-
* @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult
6+
* @typedef {import("../generated/api").CartDeliveryOptionsTransformRunResult} CartDeliveryOptionsTransformRunResult
77
*/
88

99
/**
10-
* @type {FunctionRunResult}
10+
* @type {CartDeliveryOptionsTransformRunResult}
1111
*/
1212
const NO_CHANGES = {
1313
operations: [],
1414
};
1515

1616
/**
1717
* @param {RunInput} input
18-
* @returns {FunctionRunResult}
18+
* @returns {CartDeliveryOptionsTransformRunResult}
1919
*/
2020
export function run(input) {
2121
const configuration = JSON.parse(
@@ -27,16 +27,16 @@ export function run(input) {
2727
{%- elsif flavor contains "typescript" -%}
2828
import type {
2929
RunInput,
30-
FunctionRunResult,
30+
CartDeliveryOptionsTransformRunResult,
3131
} from "../generated/api";
3232

33-
const NO_CHANGES: FunctionRunResult = {
33+
const NO_CHANGES: CartDeliveryOptionsTransformRunResult = {
3434
operations: [],
3535
};
3636

3737
type Configuration = {};
3838

39-
export function run(input: RunInput): FunctionRunResult {
39+
export function run(input: RunInput): CartDeliveryOptionsTransformRunResult {
4040
const configuration: Configuration = JSON.parse(
4141
input?.deliveryCustomization?.metafield?.value ?? "{}"
4242
);

checkout/javascript/delivery-customization/default/src/run.test.liquid

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, it, expect } from 'vitest';
33
import { run } from './run';
44

55
/**
6-
* @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult
6+
* @typedef {import("../generated/api").CartDeliveryOptionsTransformRunResult} CartDeliveryOptionsTransformRunResult
77
*/
88

99
describe('delivery customization function', () => {
@@ -13,15 +13,15 @@ describe('delivery customization function', () => {
1313
metafield: null
1414
}
1515
});
16-
const expected = /** @type {FunctionRunResult} */ ({ operations: [] });
16+
const expected = /** @type {CartDeliveryOptionsTransformRunResult} */ ({ operations: [] });
1717

1818
expect(result).toEqual(expected);
1919
});
2020
});
2121
{%- elsif flavor contains "typescript" -%}
2222
import { describe, it, expect } from 'vitest';
2323
import { run } from './run';
24-
import { FunctionRunResult } from '../generated/api';
24+
import { CartDeliveryOptionsTransformRunResult } from '../generated/api';
2525

2626
describe('delivery customization function', () => {
2727
it('returns no operations without configuration', () => {
@@ -30,7 +30,7 @@ describe('delivery customization function', () => {
3030
metafield: null
3131
}
3232
});
33-
const expected: FunctionRunResult = { operations: [] };
33+
const expected: CartDeliveryOptionsTransformRunResult = { operations: [] };
3434

3535
expect(result).toEqual(expected);
3636
});

0 commit comments

Comments
 (0)