Skip to content

Commit 9e26bd3

Browse files
authored
Merge pull request #2723 from Shopify/zhuo/customer/3p-dev-field-market/location
[Customer][EXT] add company location to customer account Standard API
2 parents cd4408b + a731788 commit 9e26bd3

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

.changeset/gorgeous-lizards-ring.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': minor
3+
---
4+
5+
Add purchasingCompany.location to customer account Standard API.

packages/ui-extensions-react/src/surfaces/customer-account/hooks/tests/authenticated-account.test.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@ import {mount, createMockStatefulRemoteSubscribable} from './mount';
99

1010
function createMockCustomer() {
1111
return {
12-
id: `gid://shopify/Customer/${faker.datatype.number({
13-
min: 1,
14-
precision: 1,
15-
})}`,
12+
id: `gid://shopify/Customer/${faker.number.int({min: 1})}`,
1613
};
1714
}
1815

1916
function createMockPurchasingCompany() {
2017
return {
2118
company: {
22-
id: `gid://shopify/Company/${faker.datatype.number({
23-
min: 1,
24-
precision: 1,
25-
})}`,
19+
id: `gid://shopify/Company/${faker.number.int({min: 1})}`,
20+
},
21+
location: {
22+
id: `gid://shopify/CompanyLocation/${faker.number.int({min: 1})}`,
2623
},
2724
};
2825
}
@@ -60,7 +57,9 @@ describe('account Hooks', () => {
6057
);
6158
expect(purchasingCompany).toBeDefined();
6259
expect(purchasingCompany.company.id).toBeDefined();
60+
expect(purchasingCompany.location.id).toBeDefined();
6361
expect(value.company.id).toBe(purchasingCompany.company.id);
62+
expect(value.location.id).toBe(purchasingCompany.location.id);
6463
});
6564
});
6665
});

packages/ui-extensions/src/surfaces/customer-account/api/shared.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ export interface PurchasingCompany {
369369
* Include information of the company of the logged in business customer.
370370
*/
371371
company: Company;
372+
373+
/**
374+
* Include information of the company location of the logged in business customer.
375+
*/
376+
location?: CompanyLocation;
372377
}
373378

374379
export interface Company {
@@ -378,6 +383,13 @@ export interface Company {
378383
id: string;
379384
}
380385

386+
export interface CompanyLocation {
387+
/**
388+
* Company location ID.
389+
*/
390+
id: string;
391+
}
392+
381393
export interface Ui {
382394
/**
383395
* An overlay is a contextual element on top of the main interface that provides additional information or functionality.

0 commit comments

Comments
 (0)