@grafikr/shopify-typescript 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/global/Shopify.ts CHANGED
@@ -1,22 +1,27 @@
1
1
  import ProductJSON from '../type/Product';
2
2
  import ProductObject from '../type/object/Product';
3
+ import Image from './modules/Image';
4
+ import CustomerPrivacy from './modules/customerPrivacy';
3
5
 
4
6
  export default interface Shopify {
5
- Image: {
6
- switchImage: CallableFunction
7
- getSizedImageUrl: (src: string, size: string) => string
8
- imageSize: (src: string) => string | null
9
- loadImage: (src: string) => void
10
- removeProtocol: (url: string) => string
11
- }
12
- OptionSelectors: (selector: string, config: {
7
+ CountryProvinceSelector?: (country_domid: string, province_domid: string, options?: {
8
+ hideElement: string
9
+ }) => void
10
+ postLink?: (path: string, options?: {
11
+ method?: string
12
+ parameters?: object
13
+ }) => void
14
+ addListener?: (target: HTMLElement, eventName: string, callback: CallableFunction) => void
15
+ setSelectorByValue?: (selector: HTMLSelectElement, value: any) => number
16
+ Image?: Image
17
+ OptionSelectors?: (selector: string, config: {
13
18
  product: ProductJSON | ProductObject
14
19
  onVariantSelected: CallableFunction
15
- enableHistoryState: boolean
20
+ enableHistoryState?: boolean
16
21
  }) => void
17
- OptionSelectorsFromDOM: FunctionConstructor
22
+ OptionSelectorsFromDOM?: FunctionConstructor
18
23
  loadFeatures: (features: any[], callback: CallableFunction) => void
19
- customerPrivacy?: (consented: boolean, callback: CallableFunction) => void
24
+ customerPrivacy?: CustomerPrivacy
20
25
  currency: {
21
26
  active: string
22
27
  rate: string
@@ -0,0 +1,7 @@
1
+ export default interface Image {
2
+ switchImage: CallableFunction
3
+ getSizedImageUrl: (src: string, size: string) => string
4
+ imageSize: (src: string) => string | null
5
+ loadImage: (src: string) => void
6
+ removeProtocol: (url: string) => string
7
+ }
@@ -0,0 +1,15 @@
1
+ export default interface CustomerPrivacy {
2
+ getCCPAConsent(): string
3
+ getRegulation(): string
4
+ getShopPrefs(): {
5
+ limit: string[]
6
+ }
7
+ getTrackingConsent(): string
8
+ isRegulationEnforced(): boolean
9
+ setCCPAConsent(consented: boolean, callback: CallableFunction): void
10
+ setTrackingConsent(consented: boolean, callback: CallableFunction): void
11
+ shouldShowCCPABanner(): boolean
12
+ shouldShowGDPRBanner(): boolean
13
+ userCanBeTracked(): boolean
14
+ userDataCanBeSold(): boolean
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafikr/shopify-typescript",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "lint": "node_modules/.bin/eslint . --ext .js,.ts",
@@ -11,7 +11,7 @@
11
11
  "@typescript-eslint/parser": "^5.0.0",
12
12
  "eslint": "^8.4.0",
13
13
  "eslint-config-airbnb-base": "^15.0.0",
14
- "eslint-config-airbnb-typescript": "^16.1.0",
14
+ "eslint-config-airbnb-typescript": "^17.0.0",
15
15
  "eslint-plugin-import": "^2.0.0",
16
16
  "typescript": "^4.0.0"
17
17
  },
@@ -16,7 +16,7 @@ export default interface Variant {
16
16
  name: string
17
17
  public_title: string | null
18
18
  options: string[]
19
- price: number | null
19
+ price: number
20
20
  weight: number
21
21
  compare_at_price: number | null
22
22
  inventory_management: string
@@ -1,7 +1,7 @@
1
1
  import Item from './Item';
2
2
  import FeaturedImage from './FeaturedImage';
3
3
 
4
- export default interface Article extends Item{
4
+ export default interface Article extends Item {
5
5
  author: string
6
6
  image: string | null
7
7
  published_at: string