@swell/apps-sdk 1.0.130 → 1.0.133

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.
@@ -1,7 +1,8 @@
1
- import type { SwellData, SwellRecord } from 'types/swell';
2
- import type { PartialSwellProduct, PartialSwellVariant } from './swell_types';
3
- export declare function calculateAddOptionsPrice(product: PartialSwellProduct, queryParams: SwellData): number;
4
- export declare function calculateAddOptionsVariantPrice(product: PartialSwellProduct, variant: PartialSwellVariant, queryParams: SwellData): number;
5
- export declare function getSelectedVariant(product: SwellRecord, queryParams: SwellData): PartialSwellVariant | undefined;
6
- export declare function getSelectedOptionValues(product: PartialSwellProduct, queryParams: SwellData): string[];
7
- export declare function getSelectedVariantOptionValues(product: PartialSwellProduct, variant: PartialSwellVariant | undefined, queryParams: SwellData): string[];
1
+ import type { SwellData } from 'types/swell';
2
+ import type { SwellProduct, SwellProductOption, SwellProductOptionValue, SwellProductPurchaseOptions, SwellVariant } from './swell_types';
3
+ export declare function getAvailableVariants(product: SwellProduct): SwellVariant[];
4
+ export declare function isOptionValueAvailable(option: SwellProductOption, value: SwellProductOptionValue, product: SwellProduct, availableVariants?: SwellVariant[]): boolean;
5
+ export declare function isOptionValueSelected(option: SwellProductOption, value: SwellProductOptionValue, product: SwellProduct, queryParams: SwellData, selectedVariant?: SwellVariant): boolean;
6
+ export declare function getSelectedVariant(product: SwellProduct, queryParams: SwellData): SwellVariant | undefined;
7
+ export declare function getSelectedVariantOptionValues(product: SwellProduct, queryParams: SwellData, variant?: SwellVariant): string[];
8
+ export declare function getPurchaseOptions(product: SwellProduct, queryParams: SwellData): SwellProductPurchaseOptions | null;
@@ -1,25 +1,71 @@
1
- export interface PartialSwellProductOptionValue {
1
+ export declare enum ScheduleInterval {
2
+ Daily = "daily",
3
+ Weekly = "weekly",
4
+ Monthly = "monthly",
5
+ Yearly = "yearly"
6
+ }
7
+ export interface SwellProductOptionValue {
2
8
  id: string;
9
+ name: string;
3
10
  price?: number;
4
11
  }
5
- export interface PartialSwellProductOption {
12
+ export interface SwellProductOption {
6
13
  active: boolean;
7
14
  variant: boolean;
15
+ name: string;
8
16
  input_type: string;
9
- values?: PartialSwellProductOptionValue[];
17
+ values?: SwellProductOptionValue[];
10
18
  }
11
- export interface PartialSwellVariant {
19
+ export interface SwellVariant {
12
20
  id: string;
13
21
  stock_status?: string;
14
22
  option_value_ids: string[];
15
23
  selected_option_values: string[];
16
24
  price?: number;
17
25
  }
18
- export interface PartialSwellProduct {
26
+ export interface SwellBillingSchedule {
27
+ interval: ScheduleInterval;
28
+ interval_count: number;
29
+ limit?: number;
30
+ trial_days?: number;
31
+ }
32
+ export interface SwellOrderSchedule {
33
+ interval: ScheduleInterval;
34
+ interval_count: number;
35
+ limit?: number;
36
+ }
37
+ export interface SwellSubscriptionPlan {
38
+ id: string;
39
+ name: string;
40
+ description: string | null;
41
+ price: number;
42
+ billing_schedule: SwellBillingSchedule;
43
+ has_order_schedule?: boolean;
44
+ order_schedule?: SwellOrderSchedule;
45
+ selected?: boolean;
46
+ }
47
+ export interface SwellProductPurchaseOptionStandard {
48
+ price: number;
49
+ sale: boolean;
50
+ sale_price?: number;
51
+ orig_price?: number;
52
+ selected?: boolean;
53
+ }
54
+ export interface SwellProductPurchaseOptionSubscription {
55
+ plans: SwellSubscriptionPlan[];
56
+ selected?: boolean;
57
+ }
58
+ export interface SwellProductPurchaseOptions {
59
+ standard?: SwellProductPurchaseOptionStandard;
60
+ subscription?: SwellProductPurchaseOptionSubscription;
61
+ }
62
+ export interface SwellProduct {
63
+ id: string;
19
64
  price: number;
20
- options?: PartialSwellProductOption[];
65
+ options?: SwellProductOption[];
21
66
  selected_option_values?: string[];
67
+ purchase_options?: SwellProductPurchaseOptions;
22
68
  variants: {
23
- results: PartialSwellVariant[];
69
+ results: SwellVariant[];
24
70
  };
25
71
  }
@@ -1,9 +1,9 @@
1
1
  import type { SwellData } from 'types/swell';
2
- import type { PartialSwellProduct, PartialSwellVariant } from './swell_types';
3
- export declare function transformSwellVariant(params: SwellData, product: PartialSwellProduct, variant: PartialSwellVariant): {
4
- price: number;
2
+ import type { SwellProduct, SwellVariant } from './swell_types';
3
+ export declare function transformSwellVariant(params: SwellData, product: SwellProduct, variant: SwellVariant): {
5
4
  selected_option_values: string[];
6
5
  id: string;
7
6
  stock_status?: string;
8
7
  option_value_ids: string[];
8
+ price?: number;
9
9
  };
@@ -381,7 +381,7 @@ export interface ShopifyProductOption {
381
381
  name: string;
382
382
  position: number;
383
383
  selected_value?: string;
384
- values: ShopifyProductOptionValue[];
384
+ values?: ShopifyProductOptionValue[];
385
385
  }
386
386
  export interface ShopifyProduct {
387
387
  available: boolean;
@@ -249,17 +249,19 @@ export interface ThemeSectionSettings extends ThemeSettings {
249
249
  export interface ThemePageSchema {
250
250
  layout?: string;
251
251
  page?: {
252
- slug?: string;
252
+ title?: string;
253
253
  label?: string;
254
+ slug?: string;
254
255
  description?: string;
255
256
  $locale?: string;
256
257
  };
257
258
  }
258
259
  interface ThemePageAdditionalProps {
259
- description?: string;
260
260
  current: number;
261
261
  label: string;
262
+ title: string;
262
263
  slug?: string;
264
+ description?: string;
263
265
  $locale?: string;
264
266
  }
265
267
  export interface ThemeCustomPage extends ThemePageAdditionalProps {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swell/apps-sdk",
3
3
  "type": "module",
4
- "version": "1.0.130",
4
+ "version": "1.0.133",
5
5
  "description": "Swell SDK for building isomorphic apps.",
6
6
  "author": "Swell",
7
7
  "license": "MIT",