Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sg/add in store pickup targets #1899

Draft
wants to merge 2 commits into
base: unstable
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/ui-extensions/src/surfaces/admin/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export type {ProductDetailsConfigurationApi} from './api/product-configuration/p
export type {ProductVariantDetailsConfigurationApi} from './api/product-configuration/product-variant-details-configuration';
export type {OrderRoutingRuleApi} from './api/order-routing-rule/order-routing-rule';
export type {ValidationSettingsApi} from './api/checkout-rules/validation-settings';
export type {InStorePickUpApi} from './api/in-store-pickup/in-store-pickup';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {Metafield} from '../shared';

export interface Data {
metafields: Metafield[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type {StandardApi} from '../standard/standard';
import type {ExtensionTarget as AnyExtensionTarget} from '../../extension-targets';

import {ApplyMetafieldsChange} from '../shared';
import {Data} from './data';

export interface InStorePickUpApi<ExtensionTarget extends AnyExtensionTarget>
extends StandardApi<ExtensionTarget> {
applyMetafieldsChange: ApplyMetafieldsChange;
data: Data;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import type {SupportedDefinitionType} from './metafields';

interface Metafield {
id?: string | null;
key: string;
value?: string | null;
namespace?: string;
type?: SupportedDefinitionType;
}
import type {Metafield} from '../shared';

interface OrderRoutingRule {
label: string;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {StandardApi} from '../standard/standard';
import type {ExtensionTarget as AnyExtensionTarget} from '../../extension-targets';

import {ApplyMetafieldsChange} from './metafields';
import {ApplyMetafieldsChange} from '../shared';
import {Data} from './data';

export interface OrderRoutingRuleApi<ExtensionTarget extends AnyExtensionTarget>
Expand Down
76 changes: 76 additions & 0 deletions packages/ui-extensions/src/surfaces/admin/api/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,79 @@ export interface Data {
*/
selected: {id: string}[];
}

const supportedDefinitionTypes = [
'boolean',
'collection_reference',
'color',
'date',
'date_time',
'dimension',
'file_reference',
'json',
'metaobject_reference',
'mixed_reference',
'money',
'multi_line_text_field',
'number_decimal',
'number_integer',
'page_reference',
'product_reference',
'rating',
'rich_text_field',
'single_line_text_field',
'product_taxonomy_value_reference',
'url',
'variant_reference',
'volume',
'weight',
'list.collection_reference',
'list.color',
'list.date',
'list.date_time',
'list.dimension',
'list.file_reference',
'list.metaobject_reference',
'list.mixed_reference',
'list.number_decimal',
'list.number_integer',
'list.page_reference',
'list.product_reference',
'list.rating',
'list.single_line_text_field',
'list.url',
'list.variant_reference',
'list.volume',
'list.weight',
] as const;

interface MetafieldUpdateChange {
type: 'updateMetafield';
key: string;
namespace?: string;
value: string | number;
valueType?: SupportedDefinitionType;
}

interface MetafieldRemoveChange {
type: 'removeMetafield';
key: string;
namespace: string;
}

type MetafieldsChange =
| MetafieldUpdateChange
| MetafieldRemoveChange
| MetafieldUpdateChange[]
| MetafieldRemoveChange[];

export type SupportedDefinitionType = typeof supportedDefinitionTypes[number];
export type ApplyMetafieldsChange = (changes: MetafieldsChange[]) => void;

export interface Metafield {
id?: string | null;
key: string;
value?: string | null;
namespace?: string;
type?: SupportedDefinitionType;
}
23 changes: 23 additions & 0 deletions packages/ui-extensions/src/surfaces/admin/extension-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
ProductDetailsConfigurationApi,
ProductVariantDetailsConfigurationApi,
OrderRoutingRuleApi,
InStorePickUpApi,
ValidationSettingsApi,
} from './api';
import {AnyComponentBuilder} from '../../shared';
Expand Down Expand Up @@ -378,6 +379,28 @@ export interface ExtensionTargets {
AllComponents
>;

/**
* Renders In Store Pickup Configuration on in store pick up settings (general and per location).
*
* See the [list of available components](/docs/api/admin-extensions/components).
*/
'admin.settings.in-store-pickup.render': RenderExtension<
InStorePickUpApi<'admin.settings.in-store-pickup.render'>,
AllComponents
>;
'admin.settings.internal-in-store-pickup.render': RenderExtension<
InStorePickUpApi<'admin.settings.internal-in-store-pickup.render'>,
AllComponents
>;
'admin.settings.in-store-pickup-location.render': RenderExtension<
InStorePickUpApi<'admin.settings.in-store-pickup-location.render'>,
AllComponents
>;
'admin.settings.internal-in-store-pickup-location.render': RenderExtension<
InStorePickUpApi<'admin.settings.internal-in-store-pickup-location.render'>,
AllComponents
>;

/**
* Renders Validation Settings within a given validation's add and edit views.
*
Expand Down
Loading