Customer Eligibility Card
The CustomerEligibilityCard
component enables users to select customers who are eligible for this discount code.
Name | Type | Description | Required |
---|---|---|---|
eligibility | Field<Eligibility> |
Whether the discount applies to all customers, specific customers, or specific customer segments. | Yes |
customerSelector | React.ReactNode |
A widget that enables users to select customers. | Yes |
selectedCustomers | Field<Customer[]> |
A list of customers that the discount will apply to. | Yes |
customerSegmentSelector | React.ReactNode |
A widget that enables users to select customer segments. | Yes |
selectedCustomerSegments | Field<CustomerSegment[]> |
A list of customer segments that the discount will apply to. | Yes |
Example Code
Anchor link to section titled "Example Code"
CustomerSelector
Anchor link to section titled "CustomerSelector"The following code is an example of the CustomerSelector
component:
CustomerPicker
Anchor link to section titled "CustomerPicker"To load the app user's customers, an authenticated server needs to proxy the GraphQL request. In the following CustomerPicker
component, ./authenticatedGraphQL
is used to do so:
CustomerSegmentSelector
Anchor link to section titled "CustomerSegmentSelector"The following code is an example of the CustomerSegmentSelector
component:
CustomerSegmentPicker
Anchor link to section titled "CustomerSegmentPicker"The following code is an example of the CustomerSegmentPicker
component. The CustomerSegmentSelector
component uses the CustomerSegmentPicker
component to load the user's segments.