@grafikr/shopify-typescript 1.0.4 → 1.1.1

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,31 +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
- CountryProvinceSelector: (country_domid: string, province_domid: string, options?: {
7
+ CountryProvinceSelector?: (country_domid: string, province_domid: string, options?: {
6
8
  hideElement: string
7
9
  }) => void
8
- postLink: (path: string, options?: {
10
+ postLink?: (path: string, options?: {
9
11
  method?: string
10
12
  parameters?: object
11
13
  }) => void
12
- addListener: (target: HTMLElement, eventName: string, callback: CallableFunction) => void
13
- setSelectorByValue: (selector: HTMLSelectElement, value: any) => number
14
- Image: {
15
- switchImage: CallableFunction
16
- getSizedImageUrl: (src: string, size: string) => string
17
- imageSize: (src: string) => string | null
18
- loadImage: (src: string) => void
19
- removeProtocol: (url: string) => string
20
- }
21
- OptionSelectors: (selector: string, config: {
14
+ addListener?: (target: HTMLElement, eventName: string, callback: CallableFunction) => void
15
+ setSelectorByValue?: (selector: HTMLSelectElement, value: any) => number
16
+ Image?: Image
17
+ OptionSelectors?: (selector: string, config: {
22
18
  product: ProductJSON | ProductObject
23
19
  onVariantSelected: CallableFunction
24
20
  enableHistoryState?: boolean
25
21
  }) => void
26
- OptionSelectorsFromDOM: FunctionConstructor
22
+ OptionSelectorsFromDOM?: FunctionConstructor
27
23
  loadFeatures: (features: any[], callback: CallableFunction) => void
28
- customerPrivacy?: (consented: boolean, callback: CallableFunction) => void
24
+ customerPrivacy?: CustomerPrivacy
29
25
  currency: {
30
26
  active: string
31
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.4",
3
+ "version": "1.1.1",
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
  },
package/type/LineItem.ts CHANGED
@@ -25,13 +25,13 @@ export default interface Item {
25
25
  final_price: number
26
26
  final_line_price: number
27
27
  url: string
28
- featured_image: [{
28
+ featured_image: {
29
29
  aspect_ratio: number
30
30
  alt: string
31
31
  height: number
32
32
  url: string
33
33
  width: number
34
- }]
34
+ }
35
35
  image: string
36
36
  handle: string
37
37
  requires_shipping: boolean
@@ -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