@shopify/app-bridge
Advanced tools
Comparing version 0.1.5 to 0.2.1
@@ -6,84 +6,5 @@ /** | ||
import { ActionSet } from '../helper'; | ||
import { Group, MetaAction } from '../types'; | ||
import { MetaAction } from '../types'; | ||
import { ErrorAction } from '../Error'; | ||
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 { | ||
readonly group: Group.Cart; | ||
readonly type: ActionType; | ||
} | ||
/** | ||
* Action Inferface | ||
*/ | ||
export interface FetchAction extends ActionBase { | ||
} | ||
export interface UpdateAction extends ActionBase { | ||
readonly payload: Payload; | ||
} | ||
export interface SetCustomerAction extends ActionBase { | ||
readonly payload: SetCustomerPayload; | ||
} | ||
export interface RemoveCustomerAction extends ActionBase { | ||
} | ||
export interface AddCustomerAddressAction extends ActionBase { | ||
readonly payload: AddCustomerAddressPayload; | ||
} | ||
export interface UpdateCustomerAddressAction extends ActionBase { | ||
readonly payload: UpdateCustomerAddressPayload; | ||
} | ||
export interface SetDiscountAction extends ActionBase { | ||
readonly payload: SetDiscountPayload; | ||
} | ||
export interface RemoveDiscountAction extends ActionBase { | ||
} | ||
export interface SetPropertiesAction extends ActionBase { | ||
readonly payload: SetPropertiesPayload; | ||
} | ||
export interface RemovePropertiesAction extends ActionBase { | ||
readonly payload: RemovePropertiesPayload; | ||
} | ||
export interface ClearAction extends ActionBase { | ||
} | ||
export interface AddLineItemAction extends ActionBase { | ||
readonly payload: AddLineItemPayload; | ||
} | ||
export interface UpdateLineItemAction extends ActionBase { | ||
readonly payload: UpdateLineItemPayload; | ||
} | ||
export interface RemoveLineItemAction extends ActionBase { | ||
readonly payload: RemoveLineItemPayload; | ||
} | ||
export interface SetLineItemDiscountAction extends ActionBase { | ||
readonly payload: SetLineItemDiscountPayload; | ||
} | ||
export interface RemoveLineItemDiscountAction extends ActionBase { | ||
readonly payload: RemoveLineItemDiscountPayload; | ||
} | ||
export interface SetLineItemPropertiesAction extends ActionBase { | ||
readonly payload: SetLineItemPropertiesPayload; | ||
} | ||
export interface RemoveLineItemPropertiesAction extends ActionBase { | ||
readonly payload: RemoveLineItemPropertiesPayload; | ||
} | ||
export declare type CartAction = FetchAction | UpdateAction | SetCustomerAction | RemoveCustomerAction | AddCustomerAddressAction | UpdateCustomerAddressAction | SetDiscountAction | RemoveDiscountAction | RemovePropertiesAction | ClearAction | AddLineItemAction | UpdateLineItemAction | RemoveLineItemAction | SetLineItemDiscountAction | RemoveLineItemDiscountAction | SetLineItemPropertiesAction | RemoveLineItemPropertiesAction | MetaAction; | ||
/** | ||
* Action Helper | ||
*/ | ||
export declare function fetch(): FetchAction; | ||
export declare function updateCartById(id: string, data: Data): UpdateAction; | ||
export declare function setCustomer(data: Customer): SetCustomerAction; | ||
export declare function removeCustomer(): RemoveCustomerAction; | ||
export declare function addCustomerAddress(data: Address): AddCustomerAddressAction; | ||
export declare function updateCustomerAddress(index: number, data: Address): UpdateCustomerAddressAction; | ||
export declare function setDiscount(data: Discount): SetDiscountAction; | ||
export declare function removeDiscount(): RemoveDiscountAction; | ||
export declare function setProperties(data: Properties): SetPropertiesAction; | ||
export declare function removeProperties(data: string[]): RemovePropertiesAction; | ||
export declare function clear(): ClearAction; | ||
export declare function addLineItem(data: LineItem): AddLineItemAction; | ||
export declare function updateLineItem(index: number, data: UpdateLineItemData): UpdateLineItemAction; | ||
export declare function removeLineItem(index: number): RemoveLineItemAction; | ||
export declare function setLineItemDiscount(index: number, data: Discount): SetLineItemDiscountAction; | ||
export declare function removeLineItemDiscount(index: number): RemoveLineItemDiscountAction; | ||
export declare function setLineItemProperties(index: number, data: Properties): SetLineItemPropertiesAction; | ||
export declare function removeLineItemProperties(index: number, data: string[]): RemoveLineItemPropertiesAction; | ||
import { Action, AddCustomerAddressPayload, AddLineItemPayload, Options, Payload, RemoveLineItemDiscountPayload, RemoveLineItemPayload, RemoveLineItemPropertiesPayload, RemovePropertiesPayload, SetCustomerPayload, SetDiscountPayload, SetLineItemDiscountPayload, SetLineItemPropertiesPayload, SetPropertiesPayload, UpdateCustomerAddressPayload, UpdateLineItemPayload } from './types'; | ||
export declare function validationError(action: MetaAction): undefined | ErrorAction; | ||
@@ -94,5 +15,20 @@ /** | ||
export declare class Cart extends ActionSet { | ||
constructor(app: ClientApplication<any>); | ||
dispatch(action: ActionBase): this; | ||
constructor(app: ClientApplication<any>, options?: Options); | ||
dispatch(action: Action.FETCH | Action.REMOVE_CUSTOMER | Action.REMOVE_DISCOUNT | Action.CLEAR): Cart; | ||
dispatch(action: Action.UPDATE, payload: Payload): Cart; | ||
dispatch(action: Action.SET_CUSTOMER, payload: SetCustomerPayload): Cart; | ||
dispatch(action: Action.ADD_CUSTOMER_ADDRESS, payload: AddCustomerAddressPayload): Cart; | ||
dispatch(action: Action.UPDATE_CUSTOMER_ADDRESS, payload: UpdateCustomerAddressPayload): Cart; | ||
dispatch(action: Action.SET_DISCOUNT, payload: SetDiscountPayload): Cart; | ||
dispatch(action: Action.SET_PROPERTIES, payload: SetPropertiesPayload): Cart; | ||
dispatch(action: Action.REMOVE_PROPERTIES, payload: RemovePropertiesPayload): Cart; | ||
dispatch(action: Action.ADD_LINE_ITEM, payload: AddLineItemPayload): Cart; | ||
dispatch(action: Action.UPDATE_LINE_ITEM, payload: UpdateLineItemPayload): Cart; | ||
dispatch(action: Action.REMOVE_LINE_ITEM, payload: RemoveLineItemPayload): Cart; | ||
dispatch(action: Action.SET_LINE_ITEM_DISCOUNT, payload: SetLineItemDiscountPayload): Cart; | ||
dispatch(action: Action.REMOVE_LINE_ITEM_DISCOUNT, payload: RemoveLineItemDiscountPayload): Cart; | ||
dispatch(action: Action.SET_LINE_ITEM_PROPERTIES, payload: SetLineItemPropertiesPayload): Cart; | ||
dispatch(action: Action.REMOVE_LINE_ITEM_PROPERTIES, payload: RemoveLineItemPropertiesPayload): Cart; | ||
private dispatchCartAction(type, payload?); | ||
} | ||
export declare function create(app: ClientApplication<any>): Cart; | ||
export declare function create(app: ClientApplication<any>, options?: Options): Cart; |
@@ -54,4 +54,7 @@ /** | ||
export interface Payload { | ||
readonly data?: Data; | ||
readonly data: Data; | ||
} | ||
export interface Options { | ||
readonly id?: string; | ||
} | ||
export interface AddCustomerAddressPayload { | ||
@@ -58,0 +61,0 @@ readonly data: Address; |
@@ -17,3 +17,3 @@ import { ClientApplication } from '../client'; | ||
subscriptions: ActionSubscription[]; | ||
constructor(app: ClientApplication<any>, type: string, group: string); | ||
constructor(app: ClientApplication<any>, type: string, group: string, id?: string); | ||
readonly component: Component; | ||
@@ -20,0 +20,0 @@ updateSubscription(subscriptionToRemove: ActionSubscription, group: string, subgroups: string[]): Unsubscribe; |
@@ -6,19 +6,36 @@ # Change Log | ||
<a name="0.1.5"></a> | ||
## [0.1.5](https://github.com/Shopify/app-bridge/compare/@shopify/app-bridge@0.1.4...@shopify/app-bridge@0.1.5) (2018-09-21) | ||
<a name="0.2.1"></a> | ||
# [0.2.1](https://github.com/Shopify/app-bridge/compare/@shopify/app-bridge@0.2.0...@shopify/app-bridge@0.2.1) (2018-09-26) | ||
### Bug Fixes | ||
* publish script ([f4d7cb7](https://github.com/Shopify/app-bridge/commit/f4d7cb7)) | ||
<a name="0.2.0"></a> | ||
# [0.2.0](https://github.com/Shopify/app-bridge/compare/@shopify/app-bridge@0.1.5...@shopify/app-bridge@0.2.0) (2018-09-26) | ||
### Bug Fixes | ||
* Stop using alias to import client types to fix `actions` module ([09053f3](https://github.com/Shopify/app-bridge/commit/09053f3)) | ||
* test cases ([a6a1597](https://github.com/Shopify/app-bridge/commit/a6a1597)) | ||
### Features | ||
* change POS cart actions to follow new dispatch pattern ([32a0c03](https://github.com/Shopify/app-bridge/commit/32a0c03)) | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
## [Unreleased] | ||
<a name="0.1.5"></a> | ||
## [0.1.5](https://github.com/Shopify/app-bridge/compare/@shopify/app-bridge@0.1.4...@shopify/app-bridge@0.1.5) (2018-09-21) | ||
### Bug Fixes | ||
* Stop using alias to import client types to fix `actions` module ([09053f3](https://github.com/Shopify/app-bridge/commit/09053f3)) | ||
----- | ||
## [v0.1.4] | ||
@@ -25,0 +42,0 @@ |
{ | ||
"name": "@shopify/app-bridge", | ||
"version": "0.1.5", | ||
"version": "0.2.1", | ||
"types": "index.d.ts", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
1736452
2429