Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Merge branch 'trunk' into fix/11855-update-deprecated-button-props
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldudzic authored Dec 8, 2023
2 parents b838338 + fd3bb5a commit b629734
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 143 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"ext-hash": "*",
"ext-json": "*",
"composer/installers": "^1.7.0",
"automattic/jetpack-autoloader": "^2.11",
"automattic/jetpack-connection": "^1.57",
"automattic/jetpack-config": "^1.15"
"automattic/jetpack-autoloader": "^3.0",
"automattic/jetpack-connection": "^2.1",
"automattic/jetpack-config": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "9.6.15",
Expand Down
187 changes: 103 additions & 84 deletions composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- [Data Stores](#data-stores)
- [Checkout Data Store](#checkout-data-store)
- [Selectors](#selectors)
- [Selectors](../../../third-party-developers/extensibility/data-store/checkout.md#selectors)
- [Actions](#actions)
- [Contexts](#contexts)
- [Shipping Method Data context](#shipping-method-data-context)
Expand Down
17 changes: 17 additions & 0 deletions docs/third-party-developers/extensibility/data-store/checkout.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [isAfterProcessing](#isafterprocessing)
- [isComplete](#iscomplete)
- [isCalculating](#iscalculating)
- [prefersCollection](#preferscollection)
- [Actions](#actions)
- [setPrefersCollection](#setpreferscollection)

Expand Down Expand Up @@ -292,6 +293,22 @@ const store = select( CHECKOUT_STORE_KEY );
const isCalculating = store.isCalculating();
```


### prefersCollection

Returns true if the customer prefers to collect their order, and false otherwise.

#### _Returns_ <!-- omit in toc -->

- _prefersCollection_ `boolean`: True if the shopper prefers to collect their order.

#### _Example_ <!-- omit in toc -->

```js
const store = select( CHECKOUT_STORE_KEY );
const prefersCollection = store.prefersCollection();
```

## Actions

### setPrefersCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
- [receiveCollectionError](#receivecollectionerror)
- [receiveLastModified](#receivelastmodified)
- [Selectors](#selectors)
- [getCollection](#getcollection)
- [getCollectionHeader](#getcollectionheader)
- [getFromState](#getfromstate)
- [getCollection](#getcollection)
- [getCollectionHeader](#getcollectionheader)
- [getCollectionHeaders](#getcollectionheaders)
- [getCollectionError](#getcollectionerror)
- [getCollectionLastModified](#getcollectionlastmodified)

## Overview

Expand Down Expand Up @@ -90,16 +94,37 @@ dispatch( receiveLastModified( timestamp ) );

## Selectors

### getFromState

This selector will return the state from the collections store.

#### _Returns_ <!-- omit in toc -->

- `object`: The state from the collections storew ith the following properties:
- _namespace_ `string`: The route namespace for the collection, eg. `/wc/blocks`.
- _resourceName_ `string`: The resource name for the collection, eg. `products/attributes`.
- _query_ `object`: The query arguments for the collection, eg. `{ order: 'ASC', sortBy: Price }`.
- _ids_ `array`: If the collection route has placeholders for ids you provide the values for those placeholders in this array (in order).
- _type_ `string`: type of the collections ie `items`.

or

- `array` | `null` | `undefined`: Returns a fallback value (specified as a parameter) when the collection lacks matching headers for the provided arguments.

#### _Example_ <!-- omit in toc -->

```js
const store = select( COLLECTIONS_STORE_KEY );
const state = store.getFromState( state, namespace, resourceName, queryString, ids, type, fallback );
```

### getCollection

This selector will return the collection for the given arguments. It has a sibling resolver, so if the selector has never been resolved, the resolver will make a request to the server for the collection and dispatch results to the store.

#### _Returns_ <!-- omit in toc -->

- _namespace_ `string`: The route namespace for the collection, eg. `/wc/blocks`.
- _resourceName_ `string`: The resource name for the collection, eg. `products/attributes`.
- _query_ `object`: The query arguments for the collection, eg. `{ order: 'ASC', sortBy: Price }`.
- _ids_ `array`: If the collection route has placeholders for ids you provide the values for those placeholders in this array (in order).
- `object`: Returns the `getFromState` object (see [`getFromState`](#getfromstate)).

### getCollectionHeader

Expand All @@ -122,6 +147,51 @@ or
- _query_ `Object`: The query arguments for the collection, eg. `{ order: 'ASC', sortBy: Price }`.
- _ids_ `Array`: If the collection route has placeholders for ids you provide the values for those placeholders in this array (in order).

### getCollectionHeaders

This selector will return the headers for a collection.

#### _Returns_ <!-- omit in toc -->

- `object`: Returns the `getFromState` object (see [`getFromState`](#getfromstate)).

#### _Example_ <!-- omit in toc -->

```js
const store = select( COLLECTIONS_STORE_KEY );
const headers = store.getCollectionHeaders( state, namespace, resourceName, queryString );
```

### getCollectionError

This selector will return any error that occurred while fetching a collection.

#### _Returns_ <!-- omit in toc -->

- `object`: Returns the `getFromState` object (see [`getFromState`](#getfromstate)).

#### _Example_ <!-- omit in toc -->

```js
const store = select( COLLECTIONS_STORE_KEY );
const error = store.getCollectionError( state, namespace, resourceName, queryString );
```

### getCollectionLastModified

This selector will return the last modified date for a collection.

#### _Returns_ <!-- omit in toc -->

- `number`: The last modified date for the collection, or `0` if there was no last modified date.

#### _Example_ <!-- omit in toc -->

```js
const store = select( COLLECTIONS_STORE_KEY );
const lastModified = store.getCollectionLastModified( state, namespace, resourceName, queryString );
```

<!-- FEEDBACK -->

---
Expand Down
Loading

0 comments on commit b629734

Please sign in to comment.