@shopify/app-bridge
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -8,3 +8,3 @@ /** | ||
import { ErrorAction } from '../Error'; | ||
import { ActionType, Address, AddCustomerAddressPayload, AddLineItemPayload, Customer, Discount, LineItem, Payload, Properties, RemoveLineItemDiscountPayload, RemoveLineItemPayload, RemoveLineItemPropertiesPayload, RemovePropertiesPayload, SetCustomerPayload, SetDiscountPayload, SetLineItemDiscountPayload, SetLineItemPropertiesPayload, SetPropertiesPayload, UpdateCustomerAddressPayload, UpdateLineItemData, UpdateLineItemPayload } from './types'; | ||
import { ActionType, Address, AddCustomerAddressPayload, AddLineItemPayload, Customer, Data, Discount, LineItem, Payload, Properties, RemoveLineItemDiscountPayload, RemoveLineItemPayload, RemoveLineItemPropertiesPayload, RemovePropertiesPayload, SetCustomerPayload, SetDiscountPayload, SetLineItemDiscountPayload, SetLineItemPropertiesPayload, SetPropertiesPayload, UpdateCustomerAddressPayload, UpdateLineItemData, UpdateLineItemPayload } from './types'; | ||
export interface ActionBase extends MetaAction { | ||
@@ -72,2 +72,3 @@ readonly group: Group.Cart; | ||
export declare function fetch(): FetchAction; | ||
export declare function updateCartById(id: string, data: Data): UpdateAction; | ||
export declare function setCustomer(data: Customer): SetCustomerAction; | ||
@@ -74,0 +75,0 @@ export declare function removeCustomer(): RemoveCustomerAction; |
@@ -46,8 +46,8 @@ /** | ||
cartDiscount?: Discount; | ||
customer: CustomerWithAddresses; | ||
grandTotal: string; | ||
customer?: CustomerWithAddresses; | ||
grandTotal?: string; | ||
lineItems?: LineItem[]; | ||
noteAttributes?: NoteAttributes; | ||
subTotal: string; | ||
taxTotal: string; | ||
subTotal?: string; | ||
taxTotal?: string; | ||
} | ||
@@ -54,0 +54,0 @@ export interface Payload { |
@@ -17,2 +17,6 @@ import { MetaAction } from '../types'; | ||
export declare function unexpectedAction<A extends MetaAction>(action: A, message?: string): ErrorAction; | ||
export declare function unsupportedOperationAction<A extends MetaAction>(action: A, message?: string): ErrorAction; | ||
export declare function persistenceAction<A extends MetaAction>(action: A, message?: string): ErrorAction; | ||
export declare function networkAction<A extends MetaAction>(action: A, message?: string): ErrorAction; | ||
export declare function permissionAction<A extends MetaAction>(action: A, message?: string): ErrorAction; | ||
export declare function isErrorEventName(eventName: string): boolean; | ||
@@ -19,0 +23,0 @@ export declare class AppBridgeError { |
@@ -11,2 +11,3 @@ import { AnyAction, MetaAction } from '../types'; | ||
NETWORK = "NETWORK", | ||
PERMISSION = "PERMISSION", | ||
} | ||
@@ -22,2 +23,3 @@ export declare enum ActionType { | ||
NETWORK = "APP::ERROR::NETWORK", | ||
PERMISSION = "APP::ERROR::PERMISSION", | ||
} | ||
@@ -24,0 +26,0 @@ export declare enum AppActionType { |
@@ -7,2 +7,26 @@ # Changelog | ||
### Added | ||
* Added ability to specify `SECRET` via environment variable | ||
* Added CODEOWNERS | ||
* Added Cart.updateById action | ||
* Export host API client load action | ||
* Export POS error actions | ||
### Changed | ||
* Clean up READMEs | ||
* Introduce more functionality for secondary actions in test app | ||
* Ignore `TEST.md` et al for npm | ||
### Fixed | ||
* Client now handles redirection correctly when `forceRedirect` is set | ||
* Fixed optional fields for cart payload | ||
### Removed | ||
* Removed `start:prodShop` task | ||
* Removed docs referencing internal setup instructions | ||
## [v0.1.1] | ||
@@ -9,0 +33,0 @@ |
@@ -6,2 +6,3 @@ /** | ||
export * from './types'; | ||
export * from './actions'; | ||
export { Frame } from './Frame'; | ||
@@ -8,0 +9,0 @@ export { fromFrame, fromWindow } from './MessageTransport'; |
{ | ||
"name": "@shopify/app-bridge", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"types": "index.d.ts", | ||
@@ -36,3 +36,2 @@ "main": "index.js", | ||
"start": "webpack-dev-server", | ||
"start:prodShop": "API_KEY=eff9519f64b4108b99ff551aba8d9344 webpack-dev-server", | ||
"test": "jest 'src'", | ||
@@ -39,0 +38,0 @@ "test:CI": "CI=true yarn test:coverage", |
@@ -1,18 +0,30 @@ | ||
# App Bridge | ||
# `@shopify/app-bridge` | ||
[![Build Status](https://travis-ci.com/Shopify/app-bridge.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/app-bridge) [![codecov](https://codecov.io/gh/Shopify/app-bridge/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https://codecov.io/gh/Shopify/app-bridge) | ||
[![Build Status](https://travis-ci.com/Shopify/app-bridge.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/app-bridge) | ||
[![codecov](https://codecov.io/gh/Shopify/app-bridge/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https://codecov.io/gh/Shopify/app-bridge) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md) | ||
[![npm version](https://badge.fury.io/js/%40shopify%2Fapp-bridge.svg)](https://badge.fury.io/js/%40shopify%2Fapp-bridge.svg) | ||
[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@shopify/app-bridge.svg)](https://img.shields.io/bundlephobia/minzip/@shopify/app-bridge.svg) | ||
> The App Bridge enables Apps on Shopify to access native Shopify features across different platforms. | ||
The App Bridge is a library that enables Apps on Shopify to access native | ||
Shopify features across different platforms. | ||
### Use App Bridge in a project | ||
`yarn add @shopify/app-bridge` | ||
## Installation | ||
### Set up a client | ||
Import the client library from the `app-bridge` package and provide configuration: | ||
``` sh | ||
yarn add @shopify/app-bridge | ||
``` | ||
```js | ||
## Usage | ||
### Set up your app | ||
Import the library from the `@shopify/app-bridge` package and provide | ||
a configuration: | ||
``` ts | ||
import createApp, {getShopOrigin} from '@shopify/app-bridge'; | ||
const app = createApp({ | ||
apiKey: 'my api key from partner dashboard', | ||
apiKey: 'API key from Shopify Partner Dashboard', | ||
shopOrigin: getShopOrigin(), | ||
@@ -22,25 +34,25 @@ }); | ||
### Use actions | ||
### Actions | ||
A list of available actions can be found in the [actions source folder](./src/actions). | ||
## Development | ||
### Build Scripts | ||
- `yarn build` build the files into CommonJS into the `lib` and ES6 inside the`lib-esm` folder with source map | ||
- `yarn start` build a development version of the libraries, and run the test app inside `test` | ||
- `yarn watch` build a development version of the libraries and automatically rebuild when files have changed | ||
- `yarn clean` remove the `lib` and `lib-esm` folders | ||
- `yarn lint` run the linter | ||
- `yarn check` run typescript checking | ||
## Contributing | ||
### Test Scripts | ||
- `yarn test` run all tests using `jest` | ||
- `yarn test:watch` run all tests in watch mode and auto-run on changes | ||
- `yarn test:coverage` run all tests and generate coverage report | ||
### Useful scripts | ||
- `yarn start` Start a development server | ||
- `yarn build` Build the library, compiling the source TypeScript into JavaScript | ||
- `yarn clean` Remove any artefacts produced by the `build` script | ||
- `yarn lint` Run the source linter | ||
- `yarn check` Run the TypeScript type checker | ||
### Running the tests | ||
- `yarn test` Run the tests | ||
- `yarn test:watch` Run the tests in watch mode and auto-rerun on changes | ||
- `yarn test:coverage` Run the tests and generate a coverage report | ||
### Prettier config | ||
To enable automatic prettier formatting copy or link the pre-commit script to | ||
`.git/hooks/pre-commit` and make sure it's executable, e.g.: | ||
```sh | ||
ln -s -f ../../scripts/pre-commit .git/hooks/pre-commit | ||
``` | ||
`.git/hooks/pre-commit` and make sure it's executable. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1691026
2325
58