From 837a33d3ae7f352f5ea5050198f11c47281c5807 Mon Sep 17 00:00:00 2001 From: Bernd Wahlen Date: Wed, 15 Jul 2026 17:18:14 +0200 Subject: [PATCH 1/3] Re-land Storefront API 2026-07 migration with post-review fixes Re-applies PR #143 (reverted in #146) together with the fixes for the issues found in review. Squashed re-land on top of the revert so the migration is fully restored (a plain re-merge of the branch would not re-introduce the reverted commits). Fixes since the revert: - CartAddressInput is a Storefront "one of" input; toJson emitted both fields, so adding a cart delivery address failed with "'CartAddressInput' requires exactly one argument, but 2 were provided". The null field is now omitted. (This is the delivery error from the revert note.) - Example collection tab hard-coded a price {min:500,max:600} filter that hid all products on most stores (the "collections show no products" from the revert note). Removed it. - Example Blog/Pages tabs spun forever on a failed fetch (catch cleared the flag without setState); they now clear the spinner and show the error or an empty state. - Example builds on the Java 25 / AGP 9 toolchain (Gradle 9.6.1, AGP 9.3.0, built-in Kotlin; flutter_inappwebview 6.2.0-beta.3 for AGP 9). - Dependency floors bumped to current versions (intl kept >=0.20.2 for flutter_localizations compatibility). Verified every migrated document and both delivery paths against a live 2026-07 storefront, ran the example app end-to-end, and confirmed model parsing on real responses. flutter analyze clean; tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 36 ++ README.md | 8 +- example/android/app/build.gradle.kts | 6 +- example/android/gradle.properties | 4 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/settings.gradle.kts | 4 +- example/lib/screens/blog_tab.dart | 55 ++- example/lib/screens/cart_tab.dart | 63 +-- example/lib/screens/collection_tab.dart | 9 +- example/lib/screens/home_tab.dart | 2 +- .../lib/screens/product_detail_screen.dart | 2 +- example/lib/screens/search_tab.dart | 2 +- example/pubspec.lock | 430 ++++++++++-------- example/pubspec.yaml | 10 +- .../cart/cart_attributes_update_mutation.dart | 79 ++-- .../cart/cart_buyer_identity_update.dart | 79 ++-- .../mutations/cart/cart_create.dart | 79 ++-- .../cart/cart_delivery_addresses_add.dart | 395 ++++++++++++++++ .../cart_discount_code_update_mutation.dart | 105 +++-- .../mutations/cart/cart_line_item_add.dart | 79 ++-- .../mutations/cart/cart_line_item_remove.dart | 79 ++-- .../mutations/cart/cart_line_item_update.dart | 79 ++-- .../mutations/cart/cart_note_update.dart | 79 ++-- .../checkout_discount_code_apply.dart | 29 +- .../mutations/checkout_email_update.dart | 29 +- .../mutations/checkout_line_item_add.dart | 29 +- .../mutations/checkout_line_item_remove.dart | 29 +- .../mutations/checkout_line_item_update.dart | 29 +- .../checkout_shipping_address_update.dart | 29 +- .../checkout_shipping_line_update.dart | 31 +- .../storefront/mutations/create_checkout.dart | 29 +- .../storefront/queries/get_all_blogs.dart | 2 +- .../get_all_collections_optimized.dart | 3 +- .../storefront/queries/get_all_orders.dart | 16 +- ...et_all_products_from_collection_by_id.dart | 18 +- .../queries/get_all_products_on_query.dart | 16 +- .../queries/get_blog_by_handle.dart | 4 +- .../storefront/queries/get_cart_by_id.dart | 79 ++-- .../get_checkout_info_with_payment_id.dart | 33 +- ...ith_payment_id_without_shipping_rates.dart | 31 +- .../queries/get_checkout_information.dart | 31 +- .../get_checkout_without_shipping_rates.dart | 29 +- .../queries/get_collection_by_id.dart | 6 +- .../storefront/queries/get_collections.dart | 13 +- .../queries/get_collections_by_ids.dart | 4 +- .../queries/get_featured_collections.dart | 13 +- .../queries/get_n_articles_sorted.dart | 4 +- .../storefront/queries/get_n_products.dart | 16 +- .../queries/get_page_by_handle.dart | 2 +- .../queries/get_product_by_handle.dart | 16 +- .../queries/get_product_recommendations.dart | 16 +- .../storefront/queries/get_products.dart | 16 +- .../queries/get_products_by_ids.dart | 16 +- ...t_x_collections_and_n_products_sorted.dart | 16 +- .../queries/get_x_products_after_cursor.dart | 16 +- ...oducts_after_cursor_within_collection.dart | 18 +- .../get_x_products_on_query_after_cursor.dart | 16 +- .../queries/localization_query.dart | 14 +- .../storefront/queries/search_product.dart | 16 +- lib/models/models.dart | 2 +- lib/models/src/cart/cart.dart | 7 +- lib/models/src/cart/cart.freezed.dart | 90 ++-- lib/models/src/cart/cart.g.dart | 14 +- .../cart_buyer_identity.dart | 2 - .../cart_buyer_identity.freezed.dart | 51 +-- .../cart_buyer_identity.g.dart | 11 - lib/models/src/cart/cart_cost/cart_cost.dart | 4 - .../src/cart/cart_cost/cart_cost.freezed.dart | 100 +--- .../src/cart/cart_cost/cart_cost.g.dart | 12 - .../src/cart/cart_delivery/cart_delivery.dart | 23 + .../cart_delivery/cart_delivery.freezed.dart | 283 ++++++++++++ .../cart/cart_delivery/cart_delivery.g.dart | 24 + .../cart_delivery_address.dart | 39 ++ .../cart_delivery_address.freezed.dart | 325 +++++++++++++ .../cart_delivery_address.g.dart | 50 ++ .../cart_selectable_address.dart | 31 ++ .../cart_selectable_address.freezed.dart | 312 +++++++++++++ .../cart_selectable_address.g.dart | 27 ++ .../cart_dicount_code/cart_discount_code.dart | 6 + .../cart_discount_code.freezed.dart | 48 +- .../cart_discount_code.g.dart | 9 +- lib/models/src/cart/cart_model.dart | 3 + .../cart_address_input.dart | 38 ++ .../cart_address_input.freezed.dart | 304 +++++++++++++ .../cart_address_input.g.dart | 23 + .../cart_buyer_identity_input.dart | 3 - .../cart_buyer_identity_input.freezed.dart | 49 +- .../cart_buyer_identity_input.g.dart | 12 - .../cart_delivery_address_input.dart | 33 ++ .../cart_delivery_address_input.freezed.dart | 304 +++++++++++++ .../cart_delivery_address_input.g.dart | 37 ++ .../cart_delivery_input.dart | 24 + .../cart_delivery_input.freezed.dart | 283 ++++++++++++ .../cart_delivery_input.g.dart | 25 + .../cart/inputs/cart_input/cart_input.dart | 5 + .../inputs/cart_input/cart_input.freezed.dart | 75 ++- .../cart/inputs/cart_input/cart_input.g.dart | 4 + lib/models/src/cart/inputs/cart_inputs.dart | 5 +- .../cart_selectable_address_input.dart | 30 ++ ...cart_selectable_address_input.freezed.dart | 309 +++++++++++++ .../cart_selectable_address_input.g.dart | 23 + .../delivery_address_input.dart | 28 -- .../delivery_address_input.freezed.dart | 304 ------------- .../delivery_address_input.g.dart | 25 - lib/models/src/collection/collection.dart | 2 +- .../src/localization/country/country.dart | 2 - .../localization/country/country.freezed.dart | 65 +-- .../src/localization/country/country.g.dart | 2 - lib/models/src/localization/localization.dart | 4 +- .../localization/localization.freezed.dart | 65 +-- .../src/localization/localization.g.dart | 2 - .../src/localization/market/market.dart | 16 - .../src/localization/market/market.g.dart | 15 - lib/models/src/order/order.dart | 22 +- lib/models/src/order/order.freezed.dart | 134 +++--- lib/models/src/order/order.g.dart | 26 +- lib/models/src/product/option/option.dart | 3 +- .../src/product/option/option.freezed.dart | 52 +-- lib/models/src/product/option/option.g.dart | 6 +- lib/models/src/product/product.dart | 2 +- .../product_option_value.dart | 21 + .../product_option_value.freezed.dart} | 118 ++--- .../product_option_value.g.dart | 13 + .../product_variant/product_variant.dart | 11 +- .../product/shopify_image/shopify_image.dart | 2 +- .../shopify_image/shopify_image.freezed.dart | 42 +- .../shopify_image/shopify_image.g.dart | 4 +- lib/shopify/src/shopify_blog.dart | 2 +- lib/shopify/src/shopify_cart.dart | 88 ++-- lib/shopify/src/shopify_page.dart | 2 +- lib/shopify/src/shopify_store.dart | 6 +- lib/shopify_config.dart | 13 +- pubspec.yaml | 23 +- test/shopify_flutter_test.dart | 178 +++++++- 134 files changed, 4816 insertions(+), 1941 deletions(-) create mode 100644 lib/graphql_operations/storefront/mutations/cart/cart_delivery_addresses_add.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_delivery.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_delivery.freezed.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_delivery.g.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.freezed.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.g.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.freezed.dart create mode 100644 lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.g.dart create mode 100644 lib/models/src/cart/inputs/cart_address_input/cart_address_input.dart create mode 100644 lib/models/src/cart/inputs/cart_address_input/cart_address_input.freezed.dart create mode 100644 lib/models/src/cart/inputs/cart_address_input/cart_address_input.g.dart create mode 100644 lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.dart create mode 100644 lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.freezed.dart create mode 100644 lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.g.dart create mode 100644 lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.dart create mode 100644 lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.freezed.dart create mode 100644 lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.g.dart create mode 100644 lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.dart create mode 100644 lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.freezed.dart create mode 100644 lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.g.dart delete mode 100644 lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.dart delete mode 100644 lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.freezed.dart delete mode 100644 lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.g.dart delete mode 100644 lib/models/src/localization/market/market.dart delete mode 100644 lib/models/src/localization/market/market.g.dart create mode 100644 lib/models/src/product/product_option_value/product_option_value.dart rename lib/models/src/{localization/market/market.freezed.dart => product/product_option_value/product_option_value.freezed.dart} (55%) create mode 100644 lib/models/src/product/product_option_value/product_option_value.g.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 61bfab40..8c5e1548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,39 @@ +# 3.0.0 +Removes every deprecated Storefront API field the package still queried, migrating to the 2026-07 replacements. Because several of these change the shape of the public Dart models, this is a breaking release. **This version now requires Storefront API `2026-07` or newer** (it relies on `Cart.lines.discountAllocations(lineLevelOnly:)` and cart-level `delivery`, both added in 2026-07); the default `storefrontApiVersion` is already `2026-07`. + +Breaking model changes: +* `ShopifyImage.originalSrc` → **`ShopifyImage.url`** (`Image.originalSrc`/`src` were deprecated in favour of `url`). Affects every image across products, collections, articles and media. +* `Option.values` (`List`) → **`Option.optionValues`** (`List`, each with `id` + `name`). New exported model `ProductOptionValue`. Mirrors `ProductOption.values` → `optionValues` in the API. +* `Order.subtotalPriceV2`/`totalPriceV2`/`totalShippingPriceV2`/`totalTaxV2`/`totalRefundedV2` → **`subtotalPrice`/`totalPrice`/`totalShippingPrice`/`totalTax`/`totalRefunded`** (the `*V2` money fields were deprecated). +* `CartCost` lost `totalTaxAmount`, `totalTaxAmountEstimated`, `totalDutyAmount`, `totalDutyAmountEstimated`. Shopify no longer returns tax/duty amounts on the cart ("no longer available and will be removed in a future version"), so these always returned null/false. +* Cart delivery addresses moved off the buyer identity: + * Removed `CartBuyerIdentity.deliveryAddressPreferences` and `CartBuyerIdentityInput.deliveryAddressPreferences` (the input field was deprecated). + * `Cart` gains **`delivery`** (`CartDelivery` → `List`, each exposing `id`, `selected`, `oneTimeUse`, and a `CartDeliveryAddress`). New exported models: `CartDelivery`, `CartSelectableAddress`, `CartDeliveryAddress`. + * `CartInput` gains **`delivery`** (`CartDeliveryInput`). New exported inputs: `CartDeliveryInput`, `CartSelectableAddressInput`, `CartAddressInput`, `CartDeliveryAddressInput`. These replace the removed `DeliveryAddressInput` (`MailingAddressInput` remains for other uses). Note the new delivery inputs take `countryCode`/`provinceCode` (e.g. `AU`/`NSW`) rather than full names. + * New `ShopifyCart.addDeliveryAddresses(cartId:, addresses:)` (mutation `cartDeliveryAddressesAdd`) to add delivery addresses to an existing cart; `updateBuyerIdentityInCart` no longer accepts addresses. +* Removed the `Market` model and its export, and the `market` field on `Localization` and `Country` (`Localization.market`/`Country.market` were deprecated with no Storefront replacement). + +Other: +* Line-level `discountAllocations` now requests `lineLevelOnly: false` so order-level allocations are included, and the deprecated cart-level `Cart.discountAllocations` selection was dropped (use the per-line allocations). +* Internal query fields migrated with no public-API impact: `Image` `originalSrc`→`url` in all documents, `ProductVariant.priceV2`/`compareAtPriceV2`→`price`/`compareAtPrice`, and `productByHandle`/`blogByHandle`/`pageByHandle`→`product`/`blog`/`page`. +* Updated the default `storefrontApiVersion` from **2024-07** to **2026-07**. 2024-07 has been sunset since July 2025; Shopify serves requests for an unsupported version from the oldest supported version instead, so callers relying on the default were silently drifting across versions as each one sunset. Callers that already pass `storefrontApiVersion` explicitly should ensure it is `2026-07` or newer (see the requirement above). +* Fixed three GraphQL documents that were rejected by the Storefront API on every currently supported version: + * `getXCollectionsAndNProductsSorted` declared `$collectonMetafields` (typo) but used `$collectionMetafields`, so the server rejected the document with `Variable "$collectionMetafields" is not defined`. The Dart caller was already passing the correctly spelled variable, so this method could never have succeeded. + * `getNArticlesSorted` selected the removed `Article.url` field. Replaced with `onlineStoreUrl`, which is what the `Article` model already parses. + * `getCollectionByIdQuery` passed a list to the single-collection lookup (`collection(ids: $ids)`); corrected to `collection(id: $id)`. This query has no caller in the package. +* Fixed `CartAddressInput` serialization. It is a Storefront "one of" input (exactly one field may be present), but `toJson` emitted both `copyFromCustomerAddressId` and `deliveryAddress`, so adding a cart delivery address (via `ShopifyCart.addDeliveryAddresses` or `CartInput.delivery`) failed with `'CartAddressInput' requires exactly one argument, but 2 were provided`. The unused (null) field is now omitted. +* Example app: builds on the Java 25 / AGP 9 toolchain (Gradle 9.6.1, AGP 9.3.0, built-in Kotlin); removed the hard-coded `price` filter on the collection tab that made collections appear empty; and fixed the Blog/Pages tabs spinning forever on a failed fetch (they now clear the spinner and show the error — e.g. a missing `unauthenticated_read_content` scope — or an empty state). + +Migration guide: +* Replace `image.originalSrc` with `image.url`. +* Replace `option.values` (strings) with `option.optionValues.map((v) => v.name)`. +* Replace `order.totalPriceV2` etc. with `order.totalPrice` (drop the `V2` suffix). +* Replace `CartBuyerIdentityInput(deliveryAddressPreferences: [...])` with either `CartInput(delivery: CartDeliveryInput(addresses: [...]))` on create, or `ShopifyCart.addDeliveryAddresses(...)` on an existing cart, and read addresses back from `cart.delivery`. +* Remove any use of `localization.market` / `country.market`. + +# 2.8.3 +* `cartDiscountCodesUpdate`: optional warnings (`CartWarningCode` `errorCode` + localized `message`) surfaced on `CartDiscountCode`. When a discount code is not applicable, the payload-level `warnings` (`errorCode`/`errorMessage`) are attached to the corresponding `CartDiscountCode` via `copyWith` after parsing. These fields are absent from the `discountCodes` JSON, so `fromJson` leaves them null. + # 2.8.2 * Fix Shopify-side validation error `Nullability mismatch on variable $discountCodes and argument discountCodes ([String!] / [String!]!)` from `ShopifyCart.updateCartDiscountCodes` against newer Storefront API versions (e.g. `2026-01`) that promoted the `cartDiscountCodesUpdate` argument from `[String!]` to `[String!]!`. The SDK's mutation document still declared the variable as the older nullable type, so the server rejected the request. Promoted the variable to `[String!]!`. Per the GraphQL spec ("All Variable Usages Are Allowed"), a non-null variable is also valid for the older nullable argument shape, so this change is forward- and backward-compatible across Storefront API versions; the Dart caller signature (`required List discountCodes`) already enforces non-null. diff --git a/README.md b/README.md index b02478dd..93414dc9 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ void main() { // Optional | Needed only if needed to call admin api adminAccessToken: "shpat_*******************", - // optional | default: 2024-07 - storefrontApiVersion: '2024-07', + // optional | default: 2026-07 + storefrontApiVersion: '2026-07', // optional | default: null cachePolicy: CachePolicy.cacheAndNetwork, @@ -55,7 +55,7 @@ void main() { > `adminAccessToken` is only required for admin api calls like `deleteCustomer()`. If you are not using that function, you may not need to provide it. -> `storefrontApiVersion` default vesion is set to '2024-07' +> `storefrontApiVersion` default vesion is set to '2026-07'. This package requires **2026-07 or newer** (the cart operations rely on fields added in 2026-07). Shopify supports each version for 12 months after release and then falls forward to the oldest supported version, so prefer keeping this current. > `language` defaults to 'en'. It is the default locale/language of the store. Only takes effect if the store supports provided language code. @@ -370,7 +370,7 @@ For more information about filters visit: 1. https://shopify.dev/docs/custom-storefronts/building-with-the-storefront-api/products-collections/filter-products#step-1-query-products - 2. https://shopify.dev/docs/api/storefront/2024-07/input-objects/productfilter + 2. https://shopify.dev/docs/api/storefront/2026-07/input-objects/productfilter
diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts index c3d837e9..ff95b520 100644 --- a/example/android/app/build.gradle.kts +++ b/example/android/app/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("com.android.application") - id("kotlin-android") + id("com.android.built-in-kotlin") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } @@ -15,10 +15,6 @@ android { targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.example.example" diff --git a/example/android/gradle.properties b/example/android/gradle.properties index fbee1d8c..d5da7278 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,2 +1,6 @@ org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true +# This builtInKotlin flag was added automatically by Flutter migrator +android.builtInKotlin=false +# This newDsl flag was added automatically by Flutter migrator +android.newDsl=false diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index e4ef43fb..269c533b 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip diff --git a/example/android/settings.gradle.kts b/example/android/settings.gradle.kts index ca7fe065..1ccd57e9 100644 --- a/example/android/settings.gradle.kts +++ b/example/android/settings.gradle.kts @@ -19,7 +19,9 @@ pluginManagement { plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "8.11.1" apply false + id("com.android.application") version "9.3.0" apply false + id("com.android.built-in-kotlin") version "9.3.0" apply false + // Kept on the classpath for legacy Flutter plugins that still apply KGP. id("org.jetbrains.kotlin.android") version "2.2.20" apply false } diff --git a/example/lib/screens/blog_tab.dart b/example/lib/screens/blog_tab.dart index 4e43baaa..724d4e3b 100644 --- a/example/lib/screens/blog_tab.dart +++ b/example/lib/screens/blog_tab.dart @@ -12,8 +12,10 @@ class BlogTab extends StatefulWidget { class BlogTabState extends State { List blogs = []; bool _isBlogsLoading = true; + String? _blogsError; List pages = []; bool _isPagesLoading = true; + String? _pagesError; @override void initState() { @@ -44,7 +46,33 @@ class BlogTabState extends State { ); } + Widget _errorView(String title, String message) { + return Center( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.error_outline, color: Colors.red, size: 40), + const SizedBox(height: 12), + Text(title, + style: const TextStyle( + fontWeight: FontWeight.bold, color: Colors.red)), + const SizedBox(height: 8), + Text(message, textAlign: TextAlign.center), + ], + ), + ), + ); + } + Widget _buildBlogList() { + if (!_isBlogsLoading && _blogsError != null) { + return _errorView('Failed to load blogs', _blogsError!); + } + if (!_isBlogsLoading && blogs.isEmpty) { + return const Center(child: Text('No blogs')); + } return Center( child: _isBlogsLoading ? const CircularProgressIndicator() @@ -76,6 +104,12 @@ class BlogTabState extends State { } Widget _buildPagesList() { + if (!_isPagesLoading && _pagesError != null) { + return _errorView('Failed to load pages', _pagesError!); + } + if (!_isPagesLoading && pages.isEmpty) { + return const Center(child: Text('No pages')); + } return Center( child: _isPagesLoading ? const CircularProgressIndicator() @@ -110,7 +144,15 @@ class BlogTabState extends State { }); } } catch (e) { - _isPagesLoading = false; + // Surface the error in the tab (e.g. ACCESS_DENIED when the Storefront + // token lacks the `unauthenticated_read_content` scope) instead of + // spinning forever. Must go through setState to rebuild. + if (mounted) { + setState(() { + _isPagesLoading = false; + _pagesError = e.toString(); + }); + } debugPrint(e.toString()); } } @@ -126,7 +168,12 @@ class BlogTabState extends State { }); } } catch (e) { - _isBlogsLoading = false; + if (mounted) { + setState(() { + _isBlogsLoading = false; + _blogsError = e.toString(); + }); + } debugPrint(e.toString()); } } @@ -191,7 +238,7 @@ class ArtilePage extends StatelessWidget { image: DecorationImage( fit: BoxFit.contain, image: NetworkImage( - article.image!.originalSrc, + article.image!.url, ))), ), const SizedBox(height: 10), @@ -240,7 +287,7 @@ class _PagePageState extends State { }); } } catch (e) { - _isLoading = false; + if (mounted) setState(() => _isLoading = false); debugPrint(e.toString()); } } diff --git a/example/lib/screens/cart_tab.dart b/example/lib/screens/cart_tab.dart index 0c7bb8b0..1d37f402 100644 --- a/example/lib/screens/cart_tab.dart +++ b/example/lib/screens/cart_tab.dart @@ -480,20 +480,29 @@ class _BuyerIndetityState extends State { email: randomEmail(), phone: randomPhone(), countryCode: buyerIndetity?.countryCode, - deliveryAddressPreferences: [ - const DeliveryAddressInput( - deliveryAddress: MailingAddressInput( + ), + ); + // Delivery addresses moved off the buyer identity in the 2026-07 + // Storefront API. Add them to the cart directly instead. + await shopifyCart.addDeliveryAddresses( + cartId: cart.id, + addresses: [ + const CartSelectableAddressInput( + selected: true, + address: CartAddressInput( + deliveryAddress: CartDeliveryAddressInput( address1: '11 Hinkler Avenue', city: 'Sydney', - country: 'Australia', + countryCode: 'AU', + provinceCode: 'NSW', firstName: 'Anderson', lastName: 'Fetter', phone: '044444444', zip: '2229', ), ), - ], - ), + ), + ], ); setState(() { cart = updatedCart; @@ -550,30 +559,30 @@ class _BuyerIndetityState extends State { ), ExpansionTile( initiallyExpanded: true, - title: const Text('Delivery Address Preferences'), + title: const Text('Delivery Addresses'), children: [ - if (buyerIndetity?.deliveryAddressPreferences?.isEmpty ?? - true) + if (cart.delivery?.addresses.isEmpty ?? true) const ListTile( - title: Text('No delivery address preferences'), - ), - ...(buyerIndetity?.deliveryAddressPreferences ?? []).map( - (mailingAddress) => ListTile( - title: Text( - '${mailingAddress?.firstName} ${mailingAddress?.lastName}'), - subtitle: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${mailingAddress?.address1}', - ), - Text( - '${mailingAddress?.city}, ${mailingAddress?.country}', - ), - ], - ), + title: Text('No delivery addresses'), ), + ...(cart.delivery?.addresses ?? []).map( + (selectable) { + final address = selectable.address; + return ListTile( + title: Text( + '${address.firstName} ${address.lastName}'), + subtitle: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('${address.address1}'), + Text( + '${address.city}, ${address.countryCode}', + ), + ], + ), + ); + }, ), ], ), diff --git a/example/lib/screens/collection_tab.dart b/example/lib/screens/collection_tab.dart index ab52ab0d..f3bdd73d 100644 --- a/example/lib/screens/collection_tab.dart +++ b/example/lib/screens/collection_tab.dart @@ -142,7 +142,7 @@ class CollectionDetailScreenState extends State { ? ClipRRect( borderRadius: BorderRadius.circular(4), child: Image.network( - product.images.first.originalSrc, + product.images.first.url, width: 60, height: 60, fit: BoxFit.cover, @@ -166,9 +166,10 @@ class CollectionDetailScreenState extends State { 4, startCursor: null, sortKey: SortKeyProductCollection.RELEVANCE, - filters: { - "price": {"min": 500, "max": 600}, - }, + // No filter: show every product in the collection. `filters` takes a + // Storefront `ProductFilter`, e.g. a price range — + // `filters: {"price": {"min": 0, "max": 100}}` — but a hard-coded range + // hides everything outside it, which looks like an empty collection. ); if (mounted) { setState(() { diff --git a/example/lib/screens/home_tab.dart b/example/lib/screens/home_tab.dart index e44915dc..2c155c94 100644 --- a/example/lib/screens/home_tab.dart +++ b/example/lib/screens/home_tab.dart @@ -80,7 +80,7 @@ class HomeTabState extends State { image: DecorationImage( fit: BoxFit.cover, image: NetworkImage( - product.images.first.originalSrc, + product.images.first.url, ))) : const BoxDecoration(), child: Stack( diff --git a/example/lib/screens/product_detail_screen.dart b/example/lib/screens/product_detail_screen.dart index 2a308d17..7e8dd69f 100644 --- a/example/lib/screens/product_detail_screen.dart +++ b/example/lib/screens/product_detail_screen.dart @@ -47,7 +47,7 @@ class ProductDetailScreenState extends State { children: [ product.images.isNotEmpty ? Image.network( - product.images.first.originalSrc, + product.images.first.url, width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height / 3, fit: BoxFit.cover, diff --git a/example/lib/screens/search_tab.dart b/example/lib/screens/search_tab.dart index 31b01eea..a0eb1766 100644 --- a/example/lib/screens/search_tab.dart +++ b/example/lib/screens/search_tab.dart @@ -132,7 +132,7 @@ class SearchTabState extends State { ), leading: product.images.isNotEmpty ? Image.network( - product.images.first.originalSrc, + product.images.first.url, width: 60, height: 60, fit: BoxFit.cover, diff --git a/example/pubspec.lock b/example/pubspec.lock index 3bac9d95..2abe05b1 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0eb33edbbe99a02e73b8bbeb6f2b65972023d902117ee8d1bf0ea1a79f83aa7b" + sha256: cd6add6f846f35fb79f3c315296703c1a24f3cfd7f4739d91a74961c1c7e9f1b url: "https://pub.dev" source: hosted - version: "90.0.0" + version: "100.0.0" alerter: dependency: "direct main" description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: analyzer - sha256: "711e3a890bb529bf55f07d73b8706f4b7504ad77e90d2f205626b116c048583f" + sha256: "6ba98576948803398b69e3a444df24eacdbe12ed699c7014e120ea38552debbf" url: "https://pub.dev" source: hosted - version: "8.3.0" + version: "13.0.0" args: dependency: transitive description: @@ -37,18 +37,18 @@ packages: dependency: transitive description: name: async - sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 url: "https://pub.dev" source: hosted - version: "2.13.0" + version: "2.13.1" audio_session: dependency: transitive description: name: audio_session - sha256: "2b7fff16a552486d078bfc09a8cde19f426dc6d6329262b684182597bec5b1ac" + sha256: f9e7711a0e24ca8b40f5d7ac374c3c6e55016f3157912badd18199cdbbca5c4d url: "https://pub.dev" source: hosted - version: "0.1.25" + version: "0.2.4" boolean_selector: dependency: transitive description: @@ -61,18 +61,18 @@ packages: dependency: transitive description: name: build - sha256: dfb67ccc9a78c642193e0c2d94cb9e48c2c818b3178a86097d644acdcde6a8d9 + sha256: "45d14a0fb23e018d8287c32fc98d726ce466b231928ed9b9200f29bd3ccd39ae" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.7" build_config: dependency: transitive description: name: build_config - sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" + sha256: f2c223156a26eea323e6244b85141d76413a80aeee9fe0b380773789fabaf8ae url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" cached_network_image: dependency: transitive description: @@ -101,10 +101,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" checked_yaml: dependency: transitive description: @@ -117,10 +117,10 @@ packages: dependency: transitive description: name: chewie - sha256: "44bcfc5f0dfd1de290c87c9d86a61308b3282a70b63435d5557cfd60f54a69ca" + sha256: "5b8f00a9373252ddd2296d0d734b3b754380e6b4728ba848aff40e97fabad339" url: "https://pub.dev" source: hosted - version: "1.13.0" + version: "1.14.1" clock: dependency: transitive description: @@ -129,6 +129,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.2" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8 + url: "https://pub.dev" + source: hosted + version: "1.2.1" collection: dependency: transitive description: @@ -141,18 +149,18 @@ packages: dependency: transitive description: name: connectivity_plus - sha256: b5e72753cf63becce2c61fd04dfe0f1c430cc5278b53a1342dc5ad839eab29ec + sha256: "25cebb79dfe304022550e0c3c893ae051ded07183d2607f7b88473cb3ade33cb" url: "https://pub.dev" source: hosted - version: "6.1.5" + version: "7.3.0" connectivity_plus_platform_interface: dependency: transitive description: name: connectivity_plus_platform_interface - sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204" + sha256: "3c09627c536d22fd24691a905cdd8b14520de69da52c7a97499c8be5284a32ed" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.0" convert: dependency: transitive description: @@ -165,10 +173,10 @@ packages: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.7" csslib: dependency: transitive description: @@ -181,26 +189,26 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" url: "https://pub.dev" source: hosted - version: "1.0.8" + version: "1.0.9" dart_style: dependency: transitive description: name: dart_style - sha256: c87dfe3d56f183ffe9106a18aebc6db431fc7c98c31a54b952a77f3d54a85697 + sha256: "59d53ef8eaed9d288ed9767618e2b31c4fa0383a127db59d5eb2e737a7638a60" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.9" dbus: dependency: transitive description: name: dbus - sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" + sha256: "0ce9b0a839e6dee59a37a623d2fc26a35bbbe6404213e419b0d6411023d62645" url: "https://pub.dev" source: hosted - version: "0.7.11" + version: "0.7.14" fake_async: dependency: transitive description: @@ -213,10 +221,18 @@ packages: dependency: transitive description: name: ffi - sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" + ffi_leak_tracker: + dependency: transitive + description: + name: ffi_leak_tracker + sha256: "4093d4ef9ca06ffe2786e73bfb25e22aa92112b9bb4ec941f11e3e6b61489a97" + url: "https://pub.dev" + source: hosted + version: "0.1.2" file: dependency: transitive description: @@ -266,58 +282,74 @@ packages: dependency: "direct main" description: name: flutter_inappwebview - sha256: "3e9a443a18ecef966fb930c3a76ca5ab6a7aafc0c7b5e14a4a850cf107b09959" + sha256: "3952d116ee93bad2946401377e7ade87b5ef200e95ecb5ba1affa1b6329a6867" url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "6.2.0-beta.3" flutter_inappwebview_android: dependency: transitive description: name: flutter_inappwebview_android - sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba" + sha256: "8dfb76bd4e507112c3942c2272eeb01fab2e42be11374e5eb226f58698e7a04b" url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "1.2.0-beta.3" flutter_inappwebview_internal_annotations: dependency: transitive description: name: flutter_inappwebview_internal_annotations - sha256: "787171d43f8af67864740b6f04166c13190aa74a1468a1f1f1e9ee5b90c359cd" + sha256: e30fba942e3debea7b7e6cdd4f0f59ce89dd403a9865193e3221293b6d1544c6 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" flutter_inappwebview_ios: dependency: transitive description: name: flutter_inappwebview_ios - sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d" + sha256: ae8a78829398771be863aa3c8804a9d40728e1815e66c9c966f86d2cc3ae4fd9 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0-beta.3" + flutter_inappwebview_linux: + dependency: transitive + description: + name: flutter_inappwebview_linux + sha256: "2e1a3b09bb911fb5a8bb155cb7f1eb1428a19b6e20363b9db48beef428b8cef5" + url: "https://pub.dev" + source: hosted + version: "0.1.0-beta.1" flutter_inappwebview_macos: dependency: transitive description: name: flutter_inappwebview_macos - sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1 + sha256: "545148cb5c46475ce669ab21621e9f2ad66e05f8e80b2cf49d4018879ab52393" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0-beta.3" flutter_inappwebview_platform_interface: dependency: transitive description: name: flutter_inappwebview_platform_interface - sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500 + sha256: e3522c76e6760d1c0a9ff690e30e1503f226783d3277fa4d26675911977e9766 url: "https://pub.dev" source: hosted - version: "1.3.0+1" + version: "1.4.0-beta.3" flutter_inappwebview_web: dependency: transitive description: name: flutter_inappwebview_web - sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598" + sha256: e98b8875ccb6a3fd255873318db45c18ab135ed0ed22d20169abad9f5c810eb9 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0-beta.3" + flutter_inappwebview_windows: + dependency: transitive + description: + name: flutter_inappwebview_windows + sha256: "902edd6f6326952af822e21aa928f7426d723d45c94c15e6ce3c2d5640d28ad7" + url: "https://pub.dev" + source: hosted + version: "0.7.0-beta.3" flutter_lints: dependency: "direct dev" description: @@ -330,10 +362,10 @@ packages: dependency: transitive description: name: flutter_svg - sha256: b9c2ad5872518a27507ab432d1fb97e8813b05f0fc693f9d40fad06d073e0678 + sha256: "35882981abcbfb8c15b286f0cd690ff25bac12d95eff3e25ee207f37d4c42e7f" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" flutter_test: dependency: "direct dev" description: flutter @@ -348,18 +380,18 @@ packages: dependency: "direct main" description: name: flutter_widget_from_html - sha256: "7f1daefcd3009c43c7e7fb37501e6bb752d79aa7bfad0085fb0444da14e89bd0" + sha256: "4fa9a0d34df0a40ac8dd20765dc83bbd8f36ceecfffa2a72a7ab178548804a04" url: "https://pub.dev" source: hosted - version: "0.17.1" + version: "0.17.2" flutter_widget_from_html_core: dependency: transitive description: name: flutter_widget_from_html_core - sha256: "1120ee6ed3509ceff2d55aa6c6cbc7b6b1291434422de2411b5a59364dd6ff03" + sha256: "7ff010b116f6abc16429923e616fbc727f3f65ef4cee12ffdb280aeecbc21e7f" url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "0.17.2" freezed_annotation: dependency: transitive description: @@ -412,10 +444,10 @@ packages: dependency: transitive description: name: fwfh_webview - sha256: f71b0aa16e15d82f3c017f33560201ff5ae04e91e970cab5d12d3bcf970b870c + sha256: "30de1ce10ee789cbd23732558a4b837d9cfd9d6b6352acf686a0113969fb2f85" url: "https://pub.dev" source: hosted - version: "0.15.6" + version: "0.15.7" glob: dependency: transitive description: @@ -484,26 +516,34 @@ packages: dependency: transitive description: name: graphql - sha256: "2011435a7fea92fff5b02c77550a54f89427a3c33c92cd2fccfd3aa87ed3727d" + sha256: a7cb0b5e8719546bf8d4edf5f57c3690ddf0fcce379c0d9d2287fdab73481090 url: "https://pub.dev" source: hosted - version: "5.2.2" + version: "5.2.4" graphql_flutter: dependency: transitive description: name: graphql_flutter - sha256: "0fef9dc2483c4f21c6ac93cd2ef0b820542fc0ce6db6efa87367326d7f36ade4" + sha256: "4164962170998bc88bed833d1aa6efc5c3a85cbc8e66a8e62f790b43f4953980" url: "https://pub.dev" source: hosted - version: "5.2.1" - hive: + version: "5.3.0" + hive_ce: + dependency: transitive + description: + name: hive_ce + sha256: "8e9980e68643afb1e765d3af32b47996552a64e190d03faf622cea07c1294418" + url: "https://pub.dev" + source: hosted + version: "2.19.3" + hooks: dependency: transitive description: - name: hive - sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + name: hooks + sha256: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.0.2" html: dependency: transitive description: @@ -516,10 +556,10 @@ packages: dependency: transitive description: name: http - sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "1.6.0" http_parser: dependency: transitive description: @@ -532,34 +572,58 @@ packages: dependency: transitive description: name: intl - sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" url: "https://pub.dev" source: hosted - version: "0.20.2" + version: "0.20.3" + isolate_channel: + dependency: transitive + description: + name: isolate_channel + sha256: a9d3d620695bc984244dafae00b95e4319d6974b2d77f4b9e1eb4f2efe099094 + url: "https://pub.dev" + source: hosted + version: "0.6.1" + jni: + dependency: transitive + description: + name: jni + sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f + url: "https://pub.dev" + source: hosted + version: "1.0.0" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" json_annotation: dependency: transitive description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.12.0" json_serializable: dependency: transitive description: name: json_serializable - sha256: "33a040668b31b320aafa4822b7b1e177e163fc3c1e835c6750319d4ab23aa6fe" + sha256: ffcd10cde35a93b2abbbcc26bd9971f4ca93763e8abe78d855e3c4177797e501 url: "https://pub.dev" source: hosted - version: "6.11.1" + version: "6.14.0" just_audio: dependency: transitive description: name: just_audio - sha256: "9694e4734f515f2a052493d1d7e0d6de219ee0427c7c29492e246ff32a219908" + sha256: e60aa97b233ddea025e13dfac59195207f528fa5e9e4a4a49a8c0766701e5fe6 url: "https://pub.dev" source: hosted - version: "0.10.5" + version: "0.10.6" just_audio_platform_interface: dependency: transitive description: @@ -604,10 +668,10 @@ packages: dependency: transitive description: name: lints - sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "6.1.0" logging: dependency: transitive description: @@ -620,26 +684,26 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.19" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: name: meta - sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.18.0" nested: dependency: transitive description: @@ -660,10 +724,18 @@ packages: dependency: transitive description: name: normalize - sha256: f78bf0552b9640c76369253f0b8fdabad4f3fbfc06bdae9359e71bee9a5b071b + sha256: "703f0af9e6f43a5a71536e977b945238bc89f1a941347e7ba467865a20cc1a9f" url: "https://pub.dev" source: hosted - version: "0.9.1" + version: "0.10.0" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "6cb691c686fa2838c6deb34980d426145c2a5d537491cb83d463c33cdbc726ed" + url: "https://pub.dev" + source: hosted + version: "9.4.1" octo_image: dependency: transitive description: @@ -684,18 +756,18 @@ packages: dependency: transitive description: name: package_info_plus - sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d + sha256: "127e1751e37ffb2ff4658beeaca77bad0c27bf5f932bd3a501c2296926d4b481" url: "https://pub.dev" source: hosted - version: "9.0.0" + version: "10.2.1" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + sha256: db762cb2f4f25ee60fb6359773861b0f199e00b90d237bd85a76a1e806b46ef4 url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "4.1.0" path: dependency: transitive description: @@ -716,42 +788,42 @@ packages: dependency: transitive description: name: path_provider - sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.1.6" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "3b4c1fc3aa55ddc9cd4aa6759984330d5c8e66aa7702a6223c61540dc6380c37" + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" url: "https://pub.dev" source: hosted - version: "2.2.19" + version: "2.3.1" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.6.0" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" path_provider_windows: dependency: transitive description: @@ -764,10 +836,10 @@ packages: dependency: transitive description: name: petitparser - sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1" + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "7.0.2" platform: dependency: transitive description: @@ -808,6 +880,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.0" + record_use: + dependency: transitive + description: + name: record_use + sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed" + url: "https://pub.dev" + source: hosted + version: "0.6.0" rxdart: dependency: transitive description: @@ -820,26 +900,26 @@ packages: dependency: transitive description: name: shared_preferences - sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + sha256: c3025c5534b01739267eb7d76959bbc25a6d10f6988e1c2a3036940133dd10bf url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.5.5" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "34266009473bf71d748912da4bf62d439185226c03e01e2d9687bc65bbfcb713" + sha256: "0634e64bd719f89c012f392938e173521f535d3ecaf66558fa94a056d22b5cc7" url: "https://pub.dev" source: hosted - version: "2.4.15" + version: "2.4.27" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" url: "https://pub.dev" source: hosted - version: "2.5.4" + version: "2.5.6" shared_preferences_linux: dependency: transitive description: @@ -852,10 +932,10 @@ packages: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" shared_preferences_web: dependency: transitive description: @@ -878,7 +958,7 @@ packages: path: ".." relative: true source: path - version: "2.6.3" + version: "3.0.0" sky_engine: dependency: transitive description: flutter @@ -888,74 +968,66 @@ packages: dependency: transitive description: name: source_gen - sha256: "9098ab86015c4f1d8af6486b547b11100e73b193e1899015033cb3e14ad20243" + sha256: ec37cc0e6694374cbef59ed79685572c870a54ede6fa30a3e420feb3adffea02 url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.2.3" source_helper: dependency: transitive description: name: source_helper - sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723" + sha256: "4227d54ceefd0bb8ca4c8fcb96e1719dc53f1ee1b6e2ca9d7a6069da160e4eae" url: "https://pub.dev" source: hosted - version: "1.3.8" + version: "1.3.12" source_span: dependency: transitive description: name: source_span - sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" - url: "https://pub.dev" - source: hosted - version: "1.10.1" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "1.10.2" sqflite: dependency: transitive description: name: sqflite - sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 + sha256: "58a799e6ac17dd32fbab93813d39ed835a75ccc0f8f85b8955fe318c6712b082" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.4.3" sqflite_android: dependency: transitive description: name: sqflite_android - sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88 + sha256: d0548f9d7422a2dae99ec6f8b0a3074463b132d216fa5ba0d230eeefc901983b url: "https://pub.dev" source: hosted - version: "2.4.2+2" + version: "2.4.3" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6" + sha256: "5bf6a55c166e73bf651ba7ec3ed486e577620e3dc8f3a9c6a258a8031b624590" url: "https://pub.dev" source: hosted - version: "2.5.6" + version: "2.5.11" sqflite_darwin: dependency: transitive description: name: sqflite_darwin - sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" + sha256: c86ca18b8f666bbf903924687fe21cc16fc385d086005067e26619ca530bef9f url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.4.3+1" sqflite_platform_interface: dependency: transitive description: name: sqflite_platform_interface - sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + sha256: f84939f84350d92d04416f8bc4dc52d3896aec7716cc9e80cf0146342139dc50 url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.1" stack_trace: dependency: transitive description: @@ -984,10 +1056,10 @@ packages: dependency: transitive description: name: synchronized - sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0 + sha256: "93b153dcb6a26dcddee6ca087dd634b53e38c10b5aa163e8e49501a776456153" url: "https://pub.dev" source: hosted - version: "3.4.0" + version: "3.4.1" term_glyph: dependency: transitive description: @@ -1000,10 +1072,10 @@ packages: dependency: transitive description: name: test_api - sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" url: "https://pub.dev" source: hosted - version: "0.7.7" + version: "0.7.11" typed_data: dependency: transitive description: @@ -1024,34 +1096,34 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "5c8b6c2d89a78f5a1cca70a73d9d5f86c701b36b42f9c9dac7bad592113c28e9" + sha256: b413d49b73867ac08dd2f9890efd3cc11f2a0e577618d50843440a1fb3776c32 url: "https://pub.dev" source: hosted - version: "6.3.24" + version: "6.3.32" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: d80b3f567a617cb923546034cc94bfe44eb15f989fe670b37f26abdb9d939cb7 + sha256: "580fe5dfb51671ae38191d316e027f6b76272b026370708c2d898799750a02b0" url: "https://pub.dev" source: hosted - version: "6.3.4" + version: "6.4.1" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.2.2" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: c043a77d6600ac9c38300567f33ef12b0ef4f4783a2c1f00231d2b1941fea13f + sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18" url: "https://pub.dev" source: hosted - version: "3.2.3" + version: "3.2.5" url_launcher_platform_interface: dependency: transitive description: @@ -1064,34 +1136,34 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + sha256: "85c81589622fbc87c1c683aaea164d3604a7777495a79d91e39ffcdec39ddb34" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" uuid: dependency: transitive description: name: uuid - sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + sha256: "9b129329f58692f6e6578329498a8fe9fbe98f090beb764ffbb8ee2eadd01dcd" url: "https://pub.dev" source: hosted - version: "4.5.1" + version: "4.6.0" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6 + sha256: "2306c03da2ba81724afeb589c351ebbc0aa7d86005925be8f8735856dbe5e42d" url: "https://pub.dev" source: hosted - version: "1.1.19" + version: "1.2.2" vector_graphics_codec: dependency: transitive description: @@ -1104,10 +1176,10 @@ packages: dependency: transitive description: name: vector_graphics_compiler - sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc + sha256: "142a9146f447d15b10bdc00e21d5f4d83e5b32bb5f8f8f5a04c75311344923a3" url: "https://pub.dev" source: hosted - version: "1.1.19" + version: "1.2.6" vector_math: dependency: transitive description: @@ -1120,34 +1192,34 @@ packages: dependency: transitive description: name: video_player - sha256: "0d55b1f1a31e5ad4c4967bfaa8ade0240b07d20ee4af1dfef5f531056512961a" + sha256: "20ef311160e2ced020a62f38e4cc399a1bf289e722fc5fe37c9d7b18e44c9e8d" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.13.0" video_player_android: dependency: transitive description: name: video_player_android - sha256: a8dc4324f67705de057678372bedb66cd08572fe7c495605ac68c5f503324a39 + sha256: "5121de08444d00363efdda630a69ad4d27a208a9f7586482d4909a44a1cdbc63" url: "https://pub.dev" source: hosted - version: "2.8.15" + version: "2.11.0" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - sha256: f9a780aac57802b2892f93787e5ea53b5f43cc57dc107bee9436458365be71cd + sha256: c238f5f0a26845cd0bcc2956049b63065a4d3c40ddfc22c3414cd170bef7fff9 url: "https://pub.dev" source: hosted - version: "2.8.4" + version: "2.11.0" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - sha256: "9e372520573311055cb353b9a0da1c9d72b094b7ba01b8ecc66f28473553793b" + sha256: "92c0fbabe20c788e71fd10d26cea998d0d253282e65d145aed0818731cf593ce" url: "https://pub.dev" source: hosted - version: "6.5.0" + version: "6.9.0" video_player_web: dependency: transitive description: @@ -1160,34 +1232,34 @@ packages: dependency: transitive description: name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360" url: "https://pub.dev" source: hosted - version: "15.0.2" + version: "15.2.0" wakelock_plus: dependency: transitive description: name: wakelock_plus - sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228" + sha256: "824c5bba0f800e86d32e57d3d1843c531f090005cc89d9a837933e6601093d53" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.6.1" wakelock_plus_platform_interface: dependency: transitive description: name: wakelock_plus_platform_interface - sha256: "036deb14cd62f558ca3b73006d52ce049fabcdcb2eddfe0bf0fe4e8a943b5cf2" + sha256: b13f99e992e7ae6a152e16c5559d3c07ff445b13330192662494e614ca3e7d7b url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.5.1" watcher: dependency: transitive description: name: watcher - sha256: "592ab6e2892f67760543fb712ff0177f4ec76c031f02f5b4ff8d3fc5eb9fb61a" + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" url: "https://pub.dev" source: hosted - version: "1.1.4" + version: "1.2.1" web: dependency: transitive description: @@ -1216,42 +1288,42 @@ packages: dependency: transitive description: name: webview_flutter - sha256: ec81f57aa1611f8ebecf1d2259da4ef052281cb5ad624131c93546c79ccc7736 + sha256: d53e1ccf5516f25017e3c9d44c39034db352d20fa34fe200674270242c2c5111 url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.14.1" webview_flutter_android: dependency: transitive description: name: webview_flutter_android - sha256: "47a8da40d02befda5b151a26dba71f47df471cddd91dfdb7802d0a87c5442558" + sha256: a97db7a44f8e71af2f3971c45550a08cce1fb60059c1b8e534251e6cfb753490 url: "https://pub.dev" source: hosted - version: "3.16.9" + version: "4.13.0" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface - sha256: "63d26ee3aca7256a83ccb576a50272edd7cfc80573a4305caa98985feb493ee0" + sha256: "1221c1b12f5278791042f2ec2841743784cf25c5a644e23d6680e5d718824f04" url: "https://pub.dev" source: hosted - version: "2.14.0" + version: "2.15.1" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview - sha256: fea63576b3b7e02b2df8b78ba92b48ed66caec2bb041e9a0b1cbd586d5d80bfd + sha256: c879dd64b87c452aa84381b244d5469da57ba7e8cca6884c7b1e0d406372c12d url: "https://pub.dev" source: hosted - version: "3.23.1" + version: "3.26.0" win32: dependency: transitive description: name: win32 - sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + sha256: ba6f4bba816c8d7e3c1580e170f3786d216951cc6b94babc3b814c08d2cb2738 url: "https://pub.dev" source: hosted - version: "5.15.0" + version: "6.3.0" xdg_directories: dependency: transitive description: @@ -1277,5 +1349,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.9.0 <4.0.0" - flutter: ">=3.35.0" + dart: ">=3.12.0 <4.0.0" + flutter: ">=3.44.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 7377085d..04ad14d2 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -10,7 +10,11 @@ dependencies: sdk: flutter shopify_flutter: path: ../ - flutter_inappwebview: 6.0.0 + # 6.2.0-beta is the first line whose Android package works with AGP 9 (the + # stable 6.1.x pulls flutter_inappwebview_android 1.1.3, which calls + # getDefaultProguardFile('proguard-android.txt') — removed in AGP 9). Move + # back to a 6.x stable once one ships the AGP 9 fix. + flutter_inappwebview: 6.2.0-beta.3 flutter_dotenv: ^5.1.0 cupertino_icons: ^1.0.2 flutter_widget_from_html: ^0.17.1 @@ -24,5 +28,5 @@ dev_dependencies: flutter: uses-material-design: true - # assets: - # - .env + assets: + - .env diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_attributes_update_mutation.dart b/lib/graphql_operations/storefront/mutations/cart/cart_attributes_update_mutation.dart index 9560b1b5..bf1756fb 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_attributes_update_mutation.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_attributes_update_mutation.dart @@ -26,22 +26,6 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +36,30 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +91,7 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +159,7 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +230,10 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +243,13 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +359,7 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co node { altText id - originalSrc + url } } } @@ -381,7 +372,7 @@ mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!, $co previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_buyer_identity_update.dart b/lib/graphql_operations/storefront/mutations/cart/cart_buyer_identity_update.dart index d0be6362..2c006a92 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_buyer_identity_update.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_buyer_identity_update.dart @@ -26,22 +26,6 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +36,30 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +91,7 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +159,7 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +230,10 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +243,13 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +359,7 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden node { altText id - originalSrc + url } } } @@ -381,7 +372,7 @@ mutation cartBuyerIdentityUpdate($country: CountryCode, $cartId: ID!, $buyerIden previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_create.dart b/lib/graphql_operations/storefront/mutations/cart/cart_create.dart index 9ecd80c0..0a3387e9 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_create.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_create.dart @@ -26,22 +26,6 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +36,30 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +91,7 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +159,7 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +230,10 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +243,13 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +359,7 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr node { altText id - originalSrc + url } } } @@ -381,7 +372,7 @@ mutation cartCreate($country: CountryCode, $input: CartInput!) @inContext(countr previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_delivery_addresses_add.dart b/lib/graphql_operations/storefront/mutations/cart/cart_delivery_addresses_add.dart new file mode 100644 index 00000000..ef8e5c15 --- /dev/null +++ b/lib/graphql_operations/storefront/mutations/cart/cart_delivery_addresses_add.dart @@ -0,0 +1,395 @@ +/// mutation to add delivery addresses to a cart +/// +/// Replaces the deprecated `buyerIdentity.deliveryAddressPreferences` input. +const String cartDeliveryAddressesAddMutation = r'''mutation cartDeliveryAddressesAdd($cartId: ID!, $addresses: [CartSelectableAddressInput!]!, $country: CountryCode, $reverse: Boolean!) @inContext(country: $country) { + cartDeliveryAddressesAdd(cartId: $cartId, addresses: $addresses) { + cart { + id + checkoutUrl + createdAt + totalQuantity + attributes { + key + value + } + cost { + checkoutChargeAmount { + amount + currencyCode + } + subtotalAmount { + amount + currencyCode + } + subtotalAmountEstimated + totalAmount { + amount + currencyCode + } + totalAmountEstimated + } + discountCodes { + applicable + code + } + note + buyerIdentity { + countryCode + email + phone + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } + } + } + } + lines(first: 250, reverse: $reverse) { + edges { + cursor + node { + id + quantity + cost { + amountPerQuantity { + amount + currencyCode + } + compareAtAmountPerQuantity { + amount + currencyCode + } + subtotalAmount { + amount + currencyCode + } + totalAmount { + amount + currencyCode + } + } + attributes { + key + value + } + discountAllocations(lineLevelOnly: false) { + discountedAmount { + amount + currencyCode + } + } + sellingPlanAllocation{ + checkoutChargeAmount { + amount + currencyCode + } + remainingBalanceChargeAmount { + amount + currencyCode + } + sellingPlan { + id + name + options { + name + value + } + description + checkoutCharge { + type + value { + ... on MoneyV2 { + amount + currencyCode + } + ... on SellingPlanCheckoutChargePercentageValue { + percentage + } + } + } + priceAdjustments { + adjustmentValue { + ... on SellingPlanFixedAmountPriceAdjustment { + adjustmentAmount { + amount + currencyCode + } + } + ... on SellingPlanFixedPriceAdjustment { + price { + amount + currencyCode + } + } + ... on SellingPlanPercentagePriceAdjustment { + adjustmentPercentage + } + } + orderCount + } + recurringDeliveries + } + } + merchandise { + ... on ProductVariant { + id + price { + amount + currencyCode + } + title + image { + altText + url + id + } + compareAtPrice { + amount + currencyCode + } + weight + weightUnit + availableForSale + quantityAvailable + sku + requiresShipping + sellingPlanAllocations(first: 250) { + nodes { + checkoutChargeAmount { + amount + currencyCode + } + remainingBalanceChargeAmount { + amount + currencyCode + } + sellingPlan { + id + name + options { + name + value + } + description + checkoutCharge { + type + value { + ... on MoneyV2 { + amount + currencyCode + } + ... on SellingPlanCheckoutChargePercentageValue { + percentage + } + } + } + priceAdjustments { + adjustmentValue { + ... on SellingPlanFixedAmountPriceAdjustment { + adjustmentAmount { + amount + currencyCode + } + } + ... on SellingPlanFixedPriceAdjustment { + price { + amount + currencyCode + } + } + ... on SellingPlanPercentagePriceAdjustment { + adjustmentPercentage + } + } + orderCount + } + recurringDeliveries + } + } + } + product { + options(first: 5) { + id + name + optionValues { + id + name + } + } + variants(first: 250) { + edges { + node { + id + title + image { + altText + id + url + } + price { + amount + currencyCode + } + compareAtPrice { + amount + currencyCode + } + weight + weightUnit + availableForSale + sku + requiresShipping + quantityAvailable + sellingPlanAllocations(first: 250) { + nodes { + checkoutChargeAmount { + amount + currencyCode + } + remainingBalanceChargeAmount { + amount + currencyCode + } + sellingPlan { + id + name + options { + name + value + } + description + checkoutCharge { + type + value { + ... on MoneyV2 { + amount + currencyCode + } + ... on SellingPlanCheckoutChargePercentageValue { + percentage + } + } + } + priceAdjustments { + adjustmentValue { + ... on SellingPlanFixedAmountPriceAdjustment { + adjustmentAmount { + amount + currencyCode + } + } + ... on SellingPlanFixedPriceAdjustment { + price { + amount + currencyCode + } + } + ... on SellingPlanPercentagePriceAdjustment { + adjustmentPercentage + } + } + orderCount + } + recurringDeliveries + } + } + } + selectedOptions { + name + value + } + } + } + pageInfo { + hasNextPage + } + } + availableForSale + collections(first: 5) { + edges { + node { + description + descriptionHtml + id + handle + updatedAt + title + } + } + } + createdAt + description + descriptionHtml + handle + id + onlineStoreUrl + productType + category { + id + name + ancestors { + id + name + } + } + tags + title + vendor + images(first: 5) { + edges { + node { + altText + id + url + } + } + } + media(first: 250) { + edges { + node { + alt + id + mediaContentType + previewImage { + altText + id + url + } + } + } + } + } + } + } + } + } + } + } + userErrors { + code + field + message + } + } +} +'''; diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_discount_code_update_mutation.dart b/lib/graphql_operations/storefront/mutations/cart/cart_discount_code_update_mutation.dart index 712fde0e..82b5c68c 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_discount_code_update_mutation.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_discount_code_update_mutation.dart @@ -1,5 +1,6 @@ -/// mutation to update cart discount codes -const String updateCartDiscountCodesMutation = r''' +/// head of the cart discount codes mutation (everything up to and including userErrors); +/// assembled with the optional warnings fragment by [updateCartDiscountCodesMutation]. +const String _updateCartDiscountCodesHead = r''' mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $country: CountryCode, $reverse: Boolean!) @inContext(country: $country) { cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) { cart { @@ -26,22 +27,6 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +37,30 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +92,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +160,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +231,10 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +244,13 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +360,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun node { altText id - originalSrc + url } } } @@ -381,7 +373,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun previewImage { altText id - originalSrc + url } } } @@ -398,6 +390,27 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $coun field message } +'''; + +/// optional payload-level warnings (CartWarningCode + localized message) explaining why a discount +/// code is not applicable; only included when the caller opts in (requires a Storefront API version +/// that supports cartDiscountCodesUpdate.warnings). +const String _updateCartDiscountCodesWarnings = r''' + warnings { + code + message + target + } +'''; + +const String _updateCartDiscountCodesTail = r''' } } '''; + +/// mutation to update cart discount codes. [includeWarnings] appends the payload-level `warnings` +/// field; off by default so the query is unchanged from upstream for callers on older API versions. +String updateCartDiscountCodesMutation({bool includeWarnings = false}) => + _updateCartDiscountCodesHead + + (includeWarnings ? _updateCartDiscountCodesWarnings : '') + + _updateCartDiscountCodesTail; diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_line_item_add.dart b/lib/graphql_operations/storefront/mutations/cart/cart_line_item_add.dart index 852a9604..9b5a74a8 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_line_item_add.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_line_item_add.dart @@ -26,22 +26,6 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +36,30 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +91,7 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +159,7 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +230,10 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +243,13 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +359,7 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI node { altText id - originalSrc + url } } } @@ -381,7 +372,7 @@ mutation cartLineItemAdd($country: CountryCode, $cartId: ID!, $lines: [CartLineI previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_line_item_remove.dart b/lib/graphql_operations/storefront/mutations/cart/cart_line_item_remove.dart index b3f41e91..ea3b84c9 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_line_item_remove.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_line_item_remove.dart @@ -26,22 +26,6 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +36,30 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +91,7 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +159,7 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +230,10 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +243,13 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +359,7 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, node { altText id - originalSrc + url } } } @@ -381,7 +372,7 @@ mutation cartLinesRemove($country: CountryCode, $cartId: ID!, $lineIds: [ID!]!, previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_line_item_update.dart b/lib/graphql_operations/storefront/mutations/cart/cart_line_item_update.dart index 2d1996dc..4f9c908b 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_line_item_update.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_line_item_update.dart @@ -26,22 +26,6 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +36,30 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +91,7 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +159,7 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +230,10 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +243,13 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +359,7 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU node { altText id - originalSrc + url } } } @@ -381,7 +372,7 @@ mutation cartLinesUpdate($country: CountryCode, $cartId: ID!, $lines: [CartLineU previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/mutations/cart/cart_note_update.dart b/lib/graphql_operations/storefront/mutations/cart/cart_note_update.dart index 162c2008..c39c97a5 100644 --- a/lib/graphql_operations/storefront/mutations/cart/cart_note_update.dart +++ b/lib/graphql_operations/storefront/mutations/cart/cart_note_update.dart @@ -26,22 +26,6 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -52,26 +36,30 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -103,7 +91,7 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -171,7 +159,7 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re title image { altText - originalSrc + url id } compareAtPrice { @@ -242,7 +230,10 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -252,13 +243,13 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -368,7 +359,7 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re node { altText id - originalSrc + url } } } @@ -381,7 +372,7 @@ mutation cartNoteUpdate($cartId: ID!, $note: String!, $country: CountryCode, $re previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/mutations/checkout_discount_code_apply.dart b/lib/graphql_operations/storefront/mutations/checkout_discount_code_apply.dart index 92f9dec4..81e87adf 100644 --- a/lib/graphql_operations/storefront/mutations/checkout_discount_code_apply.dart +++ b/lib/graphql_operations/storefront/mutations/checkout_discount_code_apply.dart @@ -25,7 +25,7 @@ mutation checkoutDiscountCodeApplyV2($checkoutId : ID!, $discountCode : String!) requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -71,17 +71,17 @@ mutation checkoutDiscountCodeApplyV2($checkoutId : ID!, $discountCode : String!) } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -95,7 +95,10 @@ mutation checkoutDiscountCodeApplyV2($checkoutId : ID!, $discountCode : String!) options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -105,13 +108,13 @@ mutation checkoutDiscountCodeApplyV2($checkoutId : ID!, $discountCode : String!) image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -167,7 +170,7 @@ mutation checkoutDiscountCodeApplyV2($checkoutId : ID!, $discountCode : String!) node { altText id - originalSrc + url } } } @@ -180,7 +183,7 @@ mutation checkoutDiscountCodeApplyV2($checkoutId : ID!, $discountCode : String!) previewImage { altText id - originalSrc + url } } } @@ -193,17 +196,17 @@ mutation checkoutDiscountCodeApplyV2($checkoutId : ID!, $discountCode : String!) note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/mutations/checkout_email_update.dart b/lib/graphql_operations/storefront/mutations/checkout_email_update.dart index f10a42a7..b752ce67 100644 --- a/lib/graphql_operations/storefront/mutations/checkout_email_update.dart +++ b/lib/graphql_operations/storefront/mutations/checkout_email_update.dart @@ -23,7 +23,7 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -69,7 +69,7 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { } variant { id - priceV2 { + price { amount currencyCode } @@ -77,10 +77,10 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { quantityAvailable image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -93,7 +93,10 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -103,13 +106,13 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -165,7 +168,7 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { node { altText id - originalSrc + url } } } @@ -178,7 +181,7 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { previewImage { altText id - originalSrc + url } } } @@ -191,17 +194,17 @@ mutation checkoutEmailUpdate($checkoutId : ID!, $email : String!) { note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/mutations/checkout_line_item_add.dart b/lib/graphql_operations/storefront/mutations/checkout_line_item_add.dart index 478a3f4e..6b8dc10d 100644 --- a/lib/graphql_operations/storefront/mutations/checkout_line_item_add.dart +++ b/lib/graphql_operations/storefront/mutations/checkout_line_item_add.dart @@ -20,7 +20,7 @@ mutation checkoutLineItemsAdd($lineItems: [CheckoutLineItemInput!]!, $checkoutId requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -66,17 +66,17 @@ mutation checkoutLineItemsAdd($lineItems: [CheckoutLineItemInput!]!, $checkoutId } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -90,7 +90,10 @@ mutation checkoutLineItemsAdd($lineItems: [CheckoutLineItemInput!]!, $checkoutId options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -100,13 +103,13 @@ mutation checkoutLineItemsAdd($lineItems: [CheckoutLineItemInput!]!, $checkoutId image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -162,7 +165,7 @@ mutation checkoutLineItemsAdd($lineItems: [CheckoutLineItemInput!]!, $checkoutId node { altText id - originalSrc + url } } } @@ -175,7 +178,7 @@ mutation checkoutLineItemsAdd($lineItems: [CheckoutLineItemInput!]!, $checkoutId previewImage { altText id - originalSrc + url } } } @@ -188,17 +191,17 @@ mutation checkoutLineItemsAdd($lineItems: [CheckoutLineItemInput!]!, $checkoutId note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/mutations/checkout_line_item_remove.dart b/lib/graphql_operations/storefront/mutations/checkout_line_item_remove.dart index 5082a94e..6f7bf308 100644 --- a/lib/graphql_operations/storefront/mutations/checkout_line_item_remove.dart +++ b/lib/graphql_operations/storefront/mutations/checkout_line_item_remove.dart @@ -20,7 +20,7 @@ mutation checkoutLineItemsRemove($lineItemIds: [ID!]!, $checkoutId: ID!) { requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -66,17 +66,17 @@ mutation checkoutLineItemsRemove($lineItemIds: [ID!]!, $checkoutId: ID!) { } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -90,7 +90,10 @@ mutation checkoutLineItemsRemove($lineItemIds: [ID!]!, $checkoutId: ID!) { options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -100,13 +103,13 @@ mutation checkoutLineItemsRemove($lineItemIds: [ID!]!, $checkoutId: ID!) { image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -162,7 +165,7 @@ mutation checkoutLineItemsRemove($lineItemIds: [ID!]!, $checkoutId: ID!) { node { altText id - originalSrc + url } } } @@ -175,7 +178,7 @@ mutation checkoutLineItemsRemove($lineItemIds: [ID!]!, $checkoutId: ID!) { previewImage { altText id - originalSrc + url } } } @@ -188,17 +191,17 @@ mutation checkoutLineItemsRemove($lineItemIds: [ID!]!, $checkoutId: ID!) { note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/mutations/checkout_line_item_update.dart b/lib/graphql_operations/storefront/mutations/checkout_line_item_update.dart index 13c67296..4fa90d77 100644 --- a/lib/graphql_operations/storefront/mutations/checkout_line_item_update.dart +++ b/lib/graphql_operations/storefront/mutations/checkout_line_item_update.dart @@ -20,7 +20,7 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -66,7 +66,7 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c } variant { id - priceV2 { + price { amount currencyCode } @@ -74,10 +74,10 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c quantityAvailable image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -90,7 +90,10 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -100,13 +103,13 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -162,7 +165,7 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c node { altText id - originalSrc + url } } } @@ -175,7 +178,7 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c previewImage { altText id - originalSrc + url } } } @@ -188,17 +191,17 @@ mutation checkoutLineItemsUpdate($lineItems: [CheckoutLineItemUpdateInput!]!, $c note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/mutations/checkout_shipping_address_update.dart b/lib/graphql_operations/storefront/mutations/checkout_shipping_address_update.dart index da53a830..107a02d9 100644 --- a/lib/graphql_operations/storefront/mutations/checkout_shipping_address_update.dart +++ b/lib/graphql_operations/storefront/mutations/checkout_shipping_address_update.dart @@ -20,7 +20,7 @@ mutation checkoutShippingAddressUpdate($checkoutId : ID!, $address1 : String, $a requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -66,17 +66,17 @@ mutation checkoutShippingAddressUpdate($checkoutId : ID!, $address1 : String, $a } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -90,7 +90,10 @@ mutation checkoutShippingAddressUpdate($checkoutId : ID!, $address1 : String, $a options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -100,13 +103,13 @@ mutation checkoutShippingAddressUpdate($checkoutId : ID!, $address1 : String, $a image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -162,7 +165,7 @@ mutation checkoutShippingAddressUpdate($checkoutId : ID!, $address1 : String, $a node { altText id - originalSrc + url } } } @@ -175,7 +178,7 @@ mutation checkoutShippingAddressUpdate($checkoutId : ID!, $address1 : String, $a previewImage { altText id - originalSrc + url } } } @@ -188,17 +191,17 @@ mutation checkoutShippingAddressUpdate($checkoutId : ID!, $address1 : String, $a note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/mutations/checkout_shipping_line_update.dart b/lib/graphql_operations/storefront/mutations/checkout_shipping_line_update.dart index ff871a55..83eca093 100644 --- a/lib/graphql_operations/storefront/mutations/checkout_shipping_line_update.dart +++ b/lib/graphql_operations/storefront/mutations/checkout_shipping_line_update.dart @@ -20,7 +20,7 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -31,7 +31,7 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin shippingRates { handle title - priceV2 { + price { amount currencyCode } @@ -77,17 +77,17 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -101,7 +101,10 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -111,13 +114,13 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -173,7 +176,7 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin node { altText id - originalSrc + url } } } @@ -186,7 +189,7 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin previewImage { altText id - originalSrc + url } } } @@ -199,17 +202,17 @@ mutation checkoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/mutations/create_checkout.dart b/lib/graphql_operations/storefront/mutations/create_checkout.dart index 4be5debb..79998dbf 100644 --- a/lib/graphql_operations/storefront/mutations/create_checkout.dart +++ b/lib/graphql_operations/storefront/mutations/create_checkout.dart @@ -25,7 +25,7 @@ mutation checkoutCreate($input: CheckoutCreateInput!) { requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -75,17 +75,17 @@ mutation checkoutCreate($input: CheckoutCreateInput!) { } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -99,7 +99,10 @@ mutation checkoutCreate($input: CheckoutCreateInput!) { options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -109,13 +112,13 @@ mutation checkoutCreate($input: CheckoutCreateInput!) { image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -171,7 +174,7 @@ mutation checkoutCreate($input: CheckoutCreateInput!) { node { altText id - originalSrc + url } } } @@ -184,7 +187,7 @@ mutation checkoutCreate($input: CheckoutCreateInput!) { previewImage { altText id - originalSrc + url } } } @@ -197,17 +200,17 @@ mutation checkoutCreate($input: CheckoutCreateInput!) { note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_all_blogs.dart b/lib/graphql_operations/storefront/queries/get_all_blogs.dart index 7547e94e..5fbe6b83 100644 --- a/lib/graphql_operations/storefront/queries/get_all_blogs.dart +++ b/lib/graphql_operations/storefront/queries/get_all_blogs.dart @@ -40,7 +40,7 @@ query getBlogs($reverseBlogs: Boolean, $reverseArticles: Boolean, $sortKey: Blog image { altText id - originalSrc + url } publishedAt tags diff --git a/lib/graphql_operations/storefront/queries/get_all_collections_optimized.dart b/lib/graphql_operations/storefront/queries/get_all_collections_optimized.dart index 432142db..1f51a021 100644 --- a/lib/graphql_operations/storefront/queries/get_all_collections_optimized.dart +++ b/lib/graphql_operations/storefront/queries/get_all_collections_optimized.dart @@ -17,7 +17,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: Colle image { altText id - originalSrc + url } metafields(identifiers: $metafields) { id @@ -29,7 +29,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: Colle reference { ... on MediaImage { image { - originalSrc url id } diff --git a/lib/graphql_operations/storefront/queries/get_all_orders.dart b/lib/graphql_operations/storefront/queries/get_all_orders.dart index 233669d6..25ca5d30 100644 --- a/lib/graphql_operations/storefront/queries/get_all_orders.dart +++ b/lib/graphql_operations/storefront/queries/get_all_orders.dart @@ -57,13 +57,13 @@ customer(customerAccessToken: $accessToken) { image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -183,23 +183,23 @@ customer(customerAccessToken: $accessToken) { zip } statusUrl - subtotalPriceV2 { + subtotalPrice { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } - totalRefundedV2 { + totalRefunded { amount currencyCode } - totalShippingPriceV2 { + totalShippingPrice { amount currencyCode } - totalTaxV2 { + totalTax { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_all_products_from_collection_by_id.dart b/lib/graphql_operations/storefront/queries/get_all_products_from_collection_by_id.dart index cb895308..36ee4310 100644 --- a/lib/graphql_operations/storefront/queries/get_all_products_from_collection_by_id.dart +++ b/lib/graphql_operations/storefront/queries/get_all_products_from_collection_by_id.dart @@ -12,7 +12,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $so image { altText id - originalSrc + url } products(first: 10, sortKey: $sortKey, after: $cursor) { edges { @@ -21,7 +21,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $so options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -33,7 +36,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $so reference { ... on MediaImage { image { - originalSrc url id } @@ -63,7 +65,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $so node { altText id - originalSrc + url } } } @@ -76,7 +78,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $so previewImage { altText id - originalSrc + url } } } @@ -101,13 +103,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $so image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_all_products_on_query.dart b/lib/graphql_operations/storefront/queries/get_all_products_on_query.dart index d828b7ba..27342e85 100644 --- a/lib/graphql_operations/storefront/queries/get_all_products_on_query.dart +++ b/lib/graphql_operations/storefront/queries/get_all_products_on_query.dart @@ -7,7 +7,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey : Prod options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -19,7 +22,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey : Prod reference { ... on MediaImage { image { - originalSrc url id } @@ -50,7 +52,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey : Prod node { altText id - originalSrc + url } } } @@ -63,7 +65,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey : Prod previewImage { altText id - originalSrc + url } } } @@ -75,13 +77,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey : Prod image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_blog_by_handle.dart b/lib/graphql_operations/storefront/queries/get_blog_by_handle.dart index b704db60..46aa6933 100644 --- a/lib/graphql_operations/storefront/queries/get_blog_by_handle.dart +++ b/lib/graphql_operations/storefront/queries/get_blog_by_handle.dart @@ -1,7 +1,7 @@ /// Query to get blog by handle const String getBlogByHandleQuery = r''' query($handle : String!, $sortKey: ArticleSortKeys, $reverseArticles: Boolean){ - blogByHandle(handle: $handle) { + blog(handle: $handle) { articles(first: 250, sortKey: $sortKey, reverse: $reverseArticles) { edges { node { @@ -34,7 +34,7 @@ query($handle : String!, $sortKey: ArticleSortKeys, $reverseArticles: Boolean){ image { altText id - originalSrc + url } publishedAt tags diff --git a/lib/graphql_operations/storefront/queries/get_cart_by_id.dart b/lib/graphql_operations/storefront/queries/get_cart_by_id.dart index e4d6c27a..1b8caeac 100644 --- a/lib/graphql_operations/storefront/queries/get_cart_by_id.dart +++ b/lib/graphql_operations/storefront/queries/get_cart_by_id.dart @@ -25,22 +25,6 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count currencyCode } totalAmountEstimated - totalDutyAmount { - amount - currencyCode - } - totalDutyAmountEstimated - totalTaxAmount { - amount - currencyCode - } - totalTaxAmountEstimated - } - discountAllocations { - discountedAmount { - amount - currencyCode - } } discountCodes { applicable @@ -51,26 +35,30 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count countryCode email phone - deliveryAddressPreferences { - ... on MailingAddress { - id - name - address1 - address2 - city - company - country - countryCodeV2 - firstName - formattedArea - formatted - lastName - latitude - longitude - phone - province - provinceCode - zip + } + delivery { + addresses { + id + selected + oneTimeUse + address { + ... on CartDeliveryAddress { + address1 + address2 + city + company + countryCode + firstName + formatted + formattedArea + lastName + latitude + longitude + name + phone + provinceCode + zip + } } } } @@ -102,7 +90,7 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count key value } - discountAllocations { + discountAllocations(lineLevelOnly: false) { discountedAmount { amount currencyCode @@ -170,7 +158,7 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count title image { altText - originalSrc + url id } compareAtPrice { @@ -241,7 +229,10 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -251,13 +242,13 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -367,7 +358,7 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count node { altText id - originalSrc + url } } } @@ -380,7 +371,7 @@ query cart($country: CountryCode, $id: ID!, $reverse: Boolean!) @inContext(count previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id.dart b/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id.dart index 4d7e5281..b9edfeb6 100644 --- a/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id.dart +++ b/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id.dart @@ -21,7 +21,7 @@ query($id: ID!){ requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -32,7 +32,7 @@ query($id: ID!){ shippingRates { handle title - priceV2 { + price { amount currencyCode } @@ -59,7 +59,7 @@ query($id: ID!){ } shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -86,17 +86,17 @@ query($id: ID!){ } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -110,7 +110,10 @@ query($id: ID!){ options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -120,13 +123,13 @@ query($id: ID!){ image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -182,7 +185,7 @@ query($id: ID!){ node { altText id - originalSrc + url } } } @@ -195,7 +198,7 @@ query($id: ID!){ previewImage { altText id - originalSrc + url } } } @@ -208,17 +211,17 @@ query($id: ID!){ note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id_without_shipping_rates.dart b/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id_without_shipping_rates.dart index 21018147..10aa1195 100644 --- a/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id_without_shipping_rates.dart +++ b/lib/graphql_operations/storefront/queries/get_checkout_info_with_payment_id_without_shipping_rates.dart @@ -21,7 +21,7 @@ query($id: ID!){ requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -48,7 +48,7 @@ query($id: ID!){ } shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -75,17 +75,17 @@ query($id: ID!){ } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -99,7 +99,10 @@ query($id: ID!){ options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -109,13 +112,13 @@ query($id: ID!){ image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -171,7 +174,7 @@ query($id: ID!){ node { altText id - originalSrc + url } } } @@ -184,7 +187,7 @@ query($id: ID!){ previewImage { altText id - originalSrc + url } } } @@ -197,17 +200,17 @@ query($id: ID!){ note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_checkout_information.dart b/lib/graphql_operations/storefront/queries/get_checkout_information.dart index a1d50e08..01611ec3 100644 --- a/lib/graphql_operations/storefront/queries/get_checkout_information.dart +++ b/lib/graphql_operations/storefront/queries/get_checkout_information.dart @@ -20,7 +20,7 @@ query($id: ID!){ requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -31,7 +31,7 @@ query($id: ID!){ shippingRates { handle title - priceV2 { + price { amount currencyCode } @@ -77,17 +77,17 @@ query($id: ID!){ } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -101,7 +101,10 @@ query($id: ID!){ options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -111,13 +114,13 @@ query($id: ID!){ image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -173,7 +176,7 @@ query($id: ID!){ node { altText id - originalSrc + url } } } @@ -186,7 +189,7 @@ query($id: ID!){ previewImage { altText id - originalSrc + url } } } @@ -199,17 +202,17 @@ query($id: ID!){ note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_checkout_without_shipping_rates.dart b/lib/graphql_operations/storefront/queries/get_checkout_without_shipping_rates.dart index 47318a53..12286276 100644 --- a/lib/graphql_operations/storefront/queries/get_checkout_without_shipping_rates.dart +++ b/lib/graphql_operations/storefront/queries/get_checkout_without_shipping_rates.dart @@ -20,7 +20,7 @@ query($id: ID!){ requiresShipping shippingLine { handle - priceV2 { + price { amount currencyCode } @@ -66,17 +66,17 @@ query($id: ID!){ } variant { id - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -90,7 +90,10 @@ query($id: ID!){ options(first: 5) { id name - values + optionValues { + id + name + } } variants(first: 250) { edges { @@ -100,13 +103,13 @@ query($id: ID!){ image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -162,7 +165,7 @@ query($id: ID!){ node { altText id - originalSrc + url } } } @@ -175,7 +178,7 @@ query($id: ID!){ previewImage { altText id - originalSrc + url } } } @@ -188,17 +191,17 @@ query($id: ID!){ note webUrl updatedAt - totalTaxV2 { + totalTax { amount currencyCode } - totalPriceV2 { + totalPrice { amount currencyCode } taxesIncluded taxExempt - subtotalPriceV2 { + subtotalPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_collection_by_id.dart b/lib/graphql_operations/storefront/queries/get_collection_by_id.dart index cb2c24e1..32f1c315 100644 --- a/lib/graphql_operations/storefront/queries/get_collection_by_id.dart +++ b/lib/graphql_operations/storefront/queries/get_collection_by_id.dart @@ -1,7 +1,7 @@ /// Query to get collection by id const String getCollectionByIdQuery = r''' -query getCollectionById($ids: [ID!]!) { - collection(ids: $ids) { +query getCollectionById($id: ID!) { + collection(id: $id) { id description descriptionHtml @@ -11,7 +11,7 @@ query getCollectionById($ids: [ID!]!) { image { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_collections.dart b/lib/graphql_operations/storefront/queries/get_collections.dart index 0b3a090a..4f2d479b 100644 --- a/lib/graphql_operations/storefront/queries/get_collections.dart +++ b/lib/graphql_operations/storefront/queries/get_collections.dart @@ -24,7 +24,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: Colle reference { ... on MediaImage { image { - originalSrc url id } @@ -34,7 +33,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: Colle image { altText id - originalSrc + url } products(first: 250) { edges { @@ -46,13 +45,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: Colle image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -146,7 +145,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: Colle node { altText id - originalSrc + url } } } @@ -159,7 +158,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: Colle previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_collections_by_ids.dart b/lib/graphql_operations/storefront/queries/get_collections_by_ids.dart index 84fed8d7..b4980305 100644 --- a/lib/graphql_operations/storefront/queries/get_collections_by_ids.dart +++ b/lib/graphql_operations/storefront/queries/get_collections_by_ids.dart @@ -14,7 +14,6 @@ query getCollectionsByIds($metafields: [HasMetafieldsIdentifier!]!, $ids: [ID!]! reference { ... on MediaImage { image { - originalSrc url id } @@ -24,8 +23,7 @@ query getCollectionsByIds($metafields: [HasMetafieldsIdentifier!]!, $ids: [ID!]! handle descriptionHtml image { - src - originalSrc + url id altText } diff --git a/lib/graphql_operations/storefront/queries/get_featured_collections.dart b/lib/graphql_operations/storefront/queries/get_featured_collections.dart index f6966a46..b55f3853 100644 --- a/lib/graphql_operations/storefront/queries/get_featured_collections.dart +++ b/lib/graphql_operations/storefront/queries/get_featured_collections.dart @@ -20,7 +20,6 @@ query getFeaturedCollectionQuery($metafields: [HasMetafieldsIdentifier!]!, $quer reference { ... on MediaImage { image { - originalSrc url id } @@ -30,7 +29,7 @@ query getFeaturedCollectionQuery($metafields: [HasMetafieldsIdentifier!]!, $quer image { altText id - originalSrc + url } products(first: 20) { edges { @@ -42,13 +41,13 @@ query getFeaturedCollectionQuery($metafields: [HasMetafieldsIdentifier!]!, $quer image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -142,7 +141,7 @@ query getFeaturedCollectionQuery($metafields: [HasMetafieldsIdentifier!]!, $quer node { altText id - originalSrc + url } } } @@ -155,7 +154,7 @@ query getFeaturedCollectionQuery($metafields: [HasMetafieldsIdentifier!]!, $quer previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_n_articles_sorted.dart b/lib/graphql_operations/storefront/queries/get_n_articles_sorted.dart index ca025672..c4c8f1a8 100644 --- a/lib/graphql_operations/storefront/queries/get_n_articles_sorted.dart +++ b/lib/graphql_operations/storefront/queries/get_n_articles_sorted.dart @@ -33,12 +33,12 @@ query($x : Int, $sortKey : ArticleSortKeys, $reverse: Boolean){ image { altText id - originalSrc + url } publishedAt tags title - url + onlineStoreUrl } } } diff --git a/lib/graphql_operations/storefront/queries/get_n_products.dart b/lib/graphql_operations/storefront/queries/get_n_products.dart index 577c0620..010928c0 100644 --- a/lib/graphql_operations/storefront/queries/get_n_products.dart +++ b/lib/graphql_operations/storefront/queries/get_n_products.dart @@ -11,7 +11,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $n : Int, options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -23,7 +26,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $n : Int, reference { ... on MediaImage { image { - originalSrc url id } @@ -38,13 +40,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $n : Int, image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -154,7 +156,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $n : Int, node { altText id - originalSrc + url } } } @@ -167,7 +169,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $n : Int, previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_page_by_handle.dart b/lib/graphql_operations/storefront/queries/get_page_by_handle.dart index 240d5511..91dbf939 100644 --- a/lib/graphql_operations/storefront/queries/get_page_by_handle.dart +++ b/lib/graphql_operations/storefront/queries/get_page_by_handle.dart @@ -1,7 +1,7 @@ /// Query to get page by handle const String getPageByHandleQuery = r''' query($handle : String!){ - pageByHandle(handle: $handle) { + page(handle: $handle) { id handle title diff --git a/lib/graphql_operations/storefront/queries/get_product_by_handle.dart b/lib/graphql_operations/storefront/queries/get_product_by_handle.dart index 7733309a..5dd2904f 100644 --- a/lib/graphql_operations/storefront/queries/get_product_by_handle.dart +++ b/lib/graphql_operations/storefront/queries/get_product_by_handle.dart @@ -1,11 +1,14 @@ /// Query to get product by handle const String getProductByHandleQuery = r''' query getProductByHandle($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $handle: String!) @inContext(country: $country) { - productByHandle(handle: $handle) { + product(handle: $handle) { options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -17,7 +20,6 @@ query getProductByHandle($metafields: [HasMetafieldsIdentifier!]!, $country: Cou reference { ... on MediaImage { image { - originalSrc url id } @@ -51,24 +53,24 @@ query getProductByHandle($metafields: [HasMetafieldsIdentifier!]!, $country: Cou node { altText id - originalSrc + url } } } variants(first: 250) { edges { node { - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_product_recommendations.dart b/lib/graphql_operations/storefront/queries/get_product_recommendations.dart index 4d975bec..1c9d5983 100644 --- a/lib/graphql_operations/storefront/queries/get_product_recommendations.dart +++ b/lib/graphql_operations/storefront/queries/get_product_recommendations.dart @@ -13,7 +13,7 @@ query getProductRecommentationsQuery($metafields: [HasMetafieldsIdentifier!]!, $ node { altText id - originalSrc + url } } } @@ -26,7 +26,7 @@ query getProductRecommentationsQuery($metafields: [HasMetafieldsIdentifier!]!, $ previewImage { altText id - originalSrc + url } } } @@ -35,7 +35,10 @@ query getProductRecommentationsQuery($metafields: [HasMetafieldsIdentifier!]!, $ options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -47,7 +50,6 @@ query getProductRecommentationsQuery($metafields: [HasMetafieldsIdentifier!]!, $ reference { ... on MediaImage { image { - originalSrc url id } @@ -74,13 +76,13 @@ query getProductRecommentationsQuery($metafields: [HasMetafieldsIdentifier!]!, $ image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_products.dart b/lib/graphql_operations/storefront/queries/get_products.dart index 142b9cc9..85ddba6d 100644 --- a/lib/graphql_operations/storefront/queries/get_products.dart +++ b/lib/graphql_operations/storefront/queries/get_products.dart @@ -11,7 +11,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $reverse: Bool options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -23,7 +26,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $reverse: Bool reference { ... on MediaImage { image { - originalSrc url id } @@ -38,13 +40,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $reverse: Bool image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -154,7 +156,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $reverse: Bool node { altText id - originalSrc + url } } } @@ -167,7 +169,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $reverse: Bool previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_products_by_ids.dart b/lib/graphql_operations/storefront/queries/get_products_by_ids.dart index 7cbf2b5a..79fa5b19 100644 --- a/lib/graphql_operations/storefront/queries/get_products_by_ids.dart +++ b/lib/graphql_operations/storefront/queries/get_products_by_ids.dart @@ -13,7 +13,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $ids : [I reference { ... on MediaImage { image { - originalSrc url id } @@ -23,7 +22,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $ids : [I options(first: 50) { id name - values + optionValues { + id + name + } } id handle @@ -49,24 +51,24 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $ids : [I node { altText id - originalSrc + url } } } variants(first: 250) { edges { node { - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -159,7 +161,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $country: CountryCode, $ids : [I previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_x_collections_and_n_products_sorted.dart b/lib/graphql_operations/storefront/queries/get_x_collections_and_n_products_sorted.dart index 73b9d4ae..08da36b2 100644 --- a/lib/graphql_operations/storefront/queries/get_x_collections_and_n_products_sorted.dart +++ b/lib/graphql_operations/storefront/queries/get_x_collections_and_n_products_sorted.dart @@ -1,6 +1,6 @@ /// Query to get x collections and n products sorted const String getXCollectionsAndNProductsSortedQuery = r''' -query($productMetafields: [HasMetafieldsIdentifier!]!, $collectonMetafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: CollectionSortKeys, $sortKeyProduct: ProductCollectionSortKeys, $reverse: Boolean, $x: Int, $n: Int, $country: CountryCode) @inContext(country: $country){ +query($productMetafields: [HasMetafieldsIdentifier!]!, $collectionMetafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: CollectionSortKeys, $sortKeyProduct: ProductCollectionSortKeys, $reverse: Boolean, $x: Int, $n: Int, $country: CountryCode) @inContext(country: $country){ collections(first: $x, after: $cursor, sortKey: $sortKey, reverse: $reverse) { pageInfo{ hasNextPage @@ -17,7 +17,7 @@ query($productMetafields: [HasMetafieldsIdentifier!]!, $collectonMetafields: [Ha image { altText id - originalSrc + url } metafields(identifiers: $collectionMetafields) { id @@ -29,7 +29,6 @@ query($productMetafields: [HasMetafieldsIdentifier!]!, $collectonMetafields: [Ha reference { ... on MediaImage { image { - originalSrc url id } @@ -49,7 +48,6 @@ query($productMetafields: [HasMetafieldsIdentifier!]!, $collectonMetafields: [Ha reference { ... on MediaImage { image { - originalSrc url id } @@ -63,13 +61,13 @@ query($productMetafields: [HasMetafieldsIdentifier!]!, $collectonMetafields: [Ha image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -151,7 +149,7 @@ query($productMetafields: [HasMetafieldsIdentifier!]!, $collectonMetafields: [Ha node { altText id - originalSrc + url } } } @@ -164,7 +162,7 @@ query($productMetafields: [HasMetafieldsIdentifier!]!, $collectonMetafields: [Ha previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_x_products_after_cursor.dart b/lib/graphql_operations/storefront/queries/get_x_products_after_cursor.dart index 6f12face..73c1035a 100644 --- a/lib/graphql_operations/storefront/queries/get_x_products_after_cursor.dart +++ b/lib/graphql_operations/storefront/queries/get_x_products_after_cursor.dart @@ -11,7 +11,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $x : Int, $rev options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -23,7 +26,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $x : Int, $rev reference { ... on MediaImage { image { - originalSrc url id } @@ -38,13 +40,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $x : Int, $rev image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } @@ -154,7 +156,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $x : Int, $rev node { altText id - originalSrc + url } } } @@ -167,7 +169,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor : String, $x : Int, $rev previewImage { altText id - originalSrc + url } } } diff --git a/lib/graphql_operations/storefront/queries/get_x_products_after_cursor_within_collection.dart b/lib/graphql_operations/storefront/queries/get_x_products_after_cursor_within_collection.dart index 01db77e8..58e51684 100644 --- a/lib/graphql_operations/storefront/queries/get_x_products_after_cursor_within_collection.dart +++ b/lib/graphql_operations/storefront/queries/get_x_products_after_cursor_within_collection.dart @@ -12,7 +12,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $li image { altText id - originalSrc + url } products(first: $limit, sortKey: $sortKey, after: $cursor, reverse: $reverse, filters: $filters) { edges { @@ -21,7 +21,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $li options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -33,7 +36,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $li reference { ... on MediaImage { image { - originalSrc url id } @@ -63,7 +65,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $li node { altText id - originalSrc + url } } } @@ -76,7 +78,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $li previewImage { altText id - originalSrc + url } } } @@ -101,13 +103,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $id : ID!, $cursor : String, $li image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/get_x_products_on_query_after_cursor.dart b/lib/graphql_operations/storefront/queries/get_x_products_on_query_after_cursor.dart index 008429a4..7cad935e 100644 --- a/lib/graphql_operations/storefront/queries/get_x_products_on_query_after_cursor.dart +++ b/lib/graphql_operations/storefront/queries/get_x_products_on_query_after_cursor.dart @@ -7,7 +7,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $limit : Int, $ options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -19,7 +22,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $limit : Int, $ reference { ... on MediaImage { image { - originalSrc url id } @@ -50,7 +52,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $limit : Int, $ node { altText id - originalSrc + url } } } @@ -63,7 +65,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $limit : Int, $ previewImage { altText id - originalSrc + url } } } @@ -75,13 +77,13 @@ query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $limit : Int, $ image { altText id - originalSrc + url } - priceV2 { + price { amount currencyCode } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } diff --git a/lib/graphql_operations/storefront/queries/localization_query.dart b/lib/graphql_operations/storefront/queries/localization_query.dart index 52b47818..2b5ce80d 100644 --- a/lib/graphql_operations/storefront/queries/localization_query.dart +++ b/lib/graphql_operations/storefront/queries/localization_query.dart @@ -1,5 +1,5 @@ /// Query to get [Localization] object -/// [Query Doc](https://shopify.dev/docs/api/storefront/2024-01/queries/localization) +/// [Query Doc](https://shopify.dev/docs/api/storefront/2026-07/queries/localization) const String getLocalizationQuery = r''' query getCountriesAndCurrencies($country: CountryCode, $language: LanguageCode) @inContext(country: $country, language: $language) { @@ -15,10 +15,6 @@ query getCountriesAndCurrencies($country: CountryCode, $language: LanguageCode) name } availableCountries { - market { - id - handle - } currency { isoCode name @@ -34,10 +30,6 @@ query getCountriesAndCurrencies($country: CountryCode, $language: LanguageCode) } } country { - market { - id - handle - } currency { isoCode name @@ -52,10 +44,6 @@ query getCountriesAndCurrencies($country: CountryCode, $language: LanguageCode) name } } - market { - id - handle - } } } '''; diff --git a/lib/graphql_operations/storefront/queries/search_product.dart b/lib/graphql_operations/storefront/queries/search_product.dart index d949bcb4..7ac9eaf6 100644 --- a/lib/graphql_operations/storefront/queries/search_product.dart +++ b/lib/graphql_operations/storefront/queries/search_product.dart @@ -12,7 +12,10 @@ query($metafields: [HasMetafieldsIdentifier!]!, $query: String!, $cursor : Strin options(first: 50) { id name - values + optionValues { + id + name + } } metafields(identifiers: $metafields) { id @@ -24,7 +27,6 @@ query($metafields: [HasMetafieldsIdentifier!]!, $query: String!, $cursor : Strin reference { ... on MediaImage { image { - originalSrc url id } @@ -55,7 +57,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $query: String!, $cursor : Strin node { altText id - originalSrc + url } } } @@ -68,7 +70,7 @@ query($metafields: [HasMetafieldsIdentifier!]!, $query: String!, $cursor : Strin previewImage { altText id - originalSrc + url } } } @@ -76,17 +78,17 @@ query($metafields: [HasMetafieldsIdentifier!]!, $query: String!, $cursor : Strin variants(first: 250) { edges { node { - priceV2 { + price { amount currencyCode } title image { altText - originalSrc + url id } - compareAtPriceV2 { + compareAtPrice { amount currencyCode } diff --git a/lib/models/models.dart b/lib/models/models.dart index e91e687c..077b8c96 100644 --- a/lib/models/models.dart +++ b/lib/models/models.dart @@ -43,6 +43,7 @@ export 'src/product/associated_collections/associated_collections.dart'; export 'src/product/metafield/metafield.dart'; export 'src/product/metafield_identifier/metafield_identifier.dart'; export 'src/product/option/option.dart'; +export 'src/product/product_option_value/product_option_value.dart'; export 'src/product/price_v_2/price_v_2.dart'; export 'src/product/product_variant/product_variant.dart'; export 'src/product/selected_option/selected_option.dart'; @@ -67,6 +68,5 @@ export 'src/localization/localization.dart'; export 'src/localization/country/country.dart'; export 'src/localization/currency/currency.dart'; export 'src/localization/language/language.dart'; -export 'src/localization/market/market.dart'; export 'src/cart/cart_model.dart'; diff --git a/lib/models/src/cart/cart.dart b/lib/models/src/cart/cart.dart index dc793a96..5c237480 100644 --- a/lib/models/src/cart/cart.dart +++ b/lib/models/src/cart/cart.dart @@ -2,7 +2,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:shopify_flutter/models/json_helper.dart'; -import 'package:shopify_flutter/models/src/cart/cart_discount_allocation/cart_discount_allocation.dart'; +import 'package:shopify_flutter/models/src/cart/cart_delivery/cart_delivery.dart'; import 'package:shopify_flutter/models/src/cart/lines/line/line.dart'; import 'attribute/attribute.dart'; import 'cart_buyer_identity/cart_buyer_identity.dart'; @@ -24,11 +24,14 @@ abstract class Cart with _$Cart { required String? checkoutUrl, required CartCost? cost, required int? totalQuantity, - required List? discountAllocations, required List? discountCodes, required String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, + + /// Delivery addresses on the cart. Replaces the deprecated + /// `buyerIdentity.deliveryAddressPreferences`. + CartDelivery? delivery, String? note, String? updatedAt, @JsonKey(fromJson: JsonHelper.lines) required List lines, diff --git a/lib/models/src/cart/cart.freezed.dart b/lib/models/src/cart/cart.freezed.dart index 672034b6..f29f76ec 100644 --- a/lib/models/src/cart/cart.freezed.dart +++ b/lib/models/src/cart/cart.freezed.dart @@ -15,7 +15,9 @@ T _$identity(T value) => value; /// @nodoc mixin _$Cart { - String get id; String? get checkoutUrl; CartCost? get cost; int? get totalQuantity; List? get discountAllocations; List? get discountCodes; String? get createdAt; List? get attributes; CartBuyerIdentity? get buyerIdentity; String? get note; String? get updatedAt;@JsonKey(fromJson: JsonHelper.lines) List get lines; + String get id; String? get checkoutUrl; CartCost? get cost; int? get totalQuantity; List? get discountCodes; String? get createdAt; List? get attributes; CartBuyerIdentity? get buyerIdentity;/// Delivery addresses on the cart. Replaces the deprecated +/// `buyerIdentity.deliveryAddressPreferences`. + CartDelivery? get delivery; String? get note; String? get updatedAt;@JsonKey(fromJson: JsonHelper.lines) List get lines; /// Create a copy of Cart /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +30,16 @@ $CartCopyWith get copyWith => _$CartCopyWithImpl(this as Cart, _$ide @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Cart&&(identical(other.id, id) || other.id == id)&&(identical(other.checkoutUrl, checkoutUrl) || other.checkoutUrl == checkoutUrl)&&(identical(other.cost, cost) || other.cost == cost)&&(identical(other.totalQuantity, totalQuantity) || other.totalQuantity == totalQuantity)&&const DeepCollectionEquality().equals(other.discountAllocations, discountAllocations)&&const DeepCollectionEquality().equals(other.discountCodes, discountCodes)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&const DeepCollectionEquality().equals(other.attributes, attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)&&(identical(other.note, note) || other.note == note)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&const DeepCollectionEquality().equals(other.lines, lines)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is Cart&&(identical(other.id, id) || other.id == id)&&(identical(other.checkoutUrl, checkoutUrl) || other.checkoutUrl == checkoutUrl)&&(identical(other.cost, cost) || other.cost == cost)&&(identical(other.totalQuantity, totalQuantity) || other.totalQuantity == totalQuantity)&&const DeepCollectionEquality().equals(other.discountCodes, discountCodes)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&const DeepCollectionEquality().equals(other.attributes, attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)&&(identical(other.delivery, delivery) || other.delivery == delivery)&&(identical(other.note, note) || other.note == note)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&const DeepCollectionEquality().equals(other.lines, lines)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,checkoutUrl,cost,totalQuantity,const DeepCollectionEquality().hash(discountAllocations),const DeepCollectionEquality().hash(discountCodes),createdAt,const DeepCollectionEquality().hash(attributes),buyerIdentity,note,updatedAt,const DeepCollectionEquality().hash(lines)); +int get hashCode => Object.hash(runtimeType,id,checkoutUrl,cost,totalQuantity,const DeepCollectionEquality().hash(discountCodes),createdAt,const DeepCollectionEquality().hash(attributes),buyerIdentity,delivery,note,updatedAt,const DeepCollectionEquality().hash(lines)); @override String toString() { - return 'Cart(id: $id, checkoutUrl: $checkoutUrl, cost: $cost, totalQuantity: $totalQuantity, discountAllocations: $discountAllocations, discountCodes: $discountCodes, createdAt: $createdAt, attributes: $attributes, buyerIdentity: $buyerIdentity, note: $note, updatedAt: $updatedAt, lines: $lines)'; + return 'Cart(id: $id, checkoutUrl: $checkoutUrl, cost: $cost, totalQuantity: $totalQuantity, discountCodes: $discountCodes, createdAt: $createdAt, attributes: $attributes, buyerIdentity: $buyerIdentity, delivery: $delivery, note: $note, updatedAt: $updatedAt, lines: $lines)'; } @@ -48,11 +50,11 @@ abstract mixin class $CartCopyWith<$Res> { factory $CartCopyWith(Cart value, $Res Function(Cart) _then) = _$CartCopyWithImpl; @useResult $Res call({ - String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountAllocations, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, String? note, String? updatedAt,@JsonKey(fromJson: JsonHelper.lines) List lines + String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, CartDelivery? delivery, String? note, String? updatedAt,@JsonKey(fromJson: JsonHelper.lines) List lines }); -$CartCostCopyWith<$Res>? get cost;$CartBuyerIdentityCopyWith<$Res>? get buyerIdentity; +$CartCostCopyWith<$Res>? get cost;$CartBuyerIdentityCopyWith<$Res>? get buyerIdentity;$CartDeliveryCopyWith<$Res>? get delivery; } /// @nodoc @@ -65,18 +67,18 @@ class _$CartCopyWithImpl<$Res> /// Create a copy of Cart /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? checkoutUrl = freezed,Object? cost = freezed,Object? totalQuantity = freezed,Object? discountAllocations = freezed,Object? discountCodes = freezed,Object? createdAt = freezed,Object? attributes = freezed,Object? buyerIdentity = freezed,Object? note = freezed,Object? updatedAt = freezed,Object? lines = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? checkoutUrl = freezed,Object? cost = freezed,Object? totalQuantity = freezed,Object? discountCodes = freezed,Object? createdAt = freezed,Object? attributes = freezed,Object? buyerIdentity = freezed,Object? delivery = freezed,Object? note = freezed,Object? updatedAt = freezed,Object? lines = null,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,checkoutUrl: freezed == checkoutUrl ? _self.checkoutUrl : checkoutUrl // ignore: cast_nullable_to_non_nullable as String?,cost: freezed == cost ? _self.cost : cost // ignore: cast_nullable_to_non_nullable as CartCost?,totalQuantity: freezed == totalQuantity ? _self.totalQuantity : totalQuantity // ignore: cast_nullable_to_non_nullable -as int?,discountAllocations: freezed == discountAllocations ? _self.discountAllocations : discountAllocations // ignore: cast_nullable_to_non_nullable -as List?,discountCodes: freezed == discountCodes ? _self.discountCodes : discountCodes // ignore: cast_nullable_to_non_nullable +as int?,discountCodes: freezed == discountCodes ? _self.discountCodes : discountCodes // ignore: cast_nullable_to_non_nullable as List?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as String?,attributes: freezed == attributes ? _self.attributes : attributes // ignore: cast_nullable_to_non_nullable as List?,buyerIdentity: freezed == buyerIdentity ? _self.buyerIdentity : buyerIdentity // ignore: cast_nullable_to_non_nullable -as CartBuyerIdentity?,note: freezed == note ? _self.note : note // ignore: cast_nullable_to_non_nullable +as CartBuyerIdentity?,delivery: freezed == delivery ? _self.delivery : delivery // ignore: cast_nullable_to_non_nullable +as CartDelivery?,note: freezed == note ? _self.note : note // ignore: cast_nullable_to_non_nullable as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as String?,lines: null == lines ? _self.lines : lines // ignore: cast_nullable_to_non_nullable as List, @@ -106,6 +108,18 @@ $CartBuyerIdentityCopyWith<$Res>? get buyerIdentity { return $CartBuyerIdentityCopyWith<$Res>(_self.buyerIdentity!, (value) { return _then(_self.copyWith(buyerIdentity: value)); }); +}/// Create a copy of Cart +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryCopyWith<$Res>? get delivery { + if (_self.delivery == null) { + return null; + } + + return $CartDeliveryCopyWith<$Res>(_self.delivery!, (value) { + return _then(_self.copyWith(delivery: value)); + }); } } @@ -188,10 +202,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountAllocations, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, String? note, String? updatedAt, @JsonKey(fromJson: JsonHelper.lines) List lines)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, CartDelivery? delivery, String? note, String? updatedAt, @JsonKey(fromJson: JsonHelper.lines) List lines)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _Cart() when $default != null: -return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that.discountAllocations,_that.discountCodes,_that.createdAt,_that.attributes,_that.buyerIdentity,_that.note,_that.updatedAt,_that.lines);case _: +return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that.discountCodes,_that.createdAt,_that.attributes,_that.buyerIdentity,_that.delivery,_that.note,_that.updatedAt,_that.lines);case _: return orElse(); } @@ -209,10 +223,10 @@ return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that. /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountAllocations, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, String? note, String? updatedAt, @JsonKey(fromJson: JsonHelper.lines) List lines) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, CartDelivery? delivery, String? note, String? updatedAt, @JsonKey(fromJson: JsonHelper.lines) List lines) $default,) {final _that = this; switch (_that) { case _Cart(): -return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that.discountAllocations,_that.discountCodes,_that.createdAt,_that.attributes,_that.buyerIdentity,_that.note,_that.updatedAt,_that.lines);case _: +return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that.discountCodes,_that.createdAt,_that.attributes,_that.buyerIdentity,_that.delivery,_that.note,_that.updatedAt,_that.lines);case _: throw StateError('Unexpected subclass'); } @@ -229,10 +243,10 @@ return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that. /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountAllocations, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, String? note, String? updatedAt, @JsonKey(fromJson: JsonHelper.lines) List lines)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, CartDelivery? delivery, String? note, String? updatedAt, @JsonKey(fromJson: JsonHelper.lines) List lines)? $default,) {final _that = this; switch (_that) { case _Cart() when $default != null: -return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that.discountAllocations,_that.discountCodes,_that.createdAt,_that.attributes,_that.buyerIdentity,_that.note,_that.updatedAt,_that.lines);case _: +return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that.discountCodes,_that.createdAt,_that.attributes,_that.buyerIdentity,_that.delivery,_that.note,_that.updatedAt,_that.lines);case _: return null; } @@ -244,22 +258,13 @@ return $default(_that.id,_that.checkoutUrl,_that.cost,_that.totalQuantity,_that. @JsonSerializable() class _Cart extends Cart { - const _Cart({required this.id, required this.checkoutUrl, required this.cost, required this.totalQuantity, required final List? discountAllocations, required final List? discountCodes, required this.createdAt, final List? attributes, this.buyerIdentity, this.note, this.updatedAt, @JsonKey(fromJson: JsonHelper.lines) required final List lines}): _discountAllocations = discountAllocations,_discountCodes = discountCodes,_attributes = attributes,_lines = lines,super._(); + const _Cart({required this.id, required this.checkoutUrl, required this.cost, required this.totalQuantity, required final List? discountCodes, required this.createdAt, final List? attributes, this.buyerIdentity, this.delivery, this.note, this.updatedAt, @JsonKey(fromJson: JsonHelper.lines) required final List lines}): _discountCodes = discountCodes,_attributes = attributes,_lines = lines,super._(); factory _Cart.fromJson(Map json) => _$CartFromJson(json); @override final String id; @override final String? checkoutUrl; @override final CartCost? cost; @override final int? totalQuantity; - final List? _discountAllocations; -@override List? get discountAllocations { - final value = _discountAllocations; - if (value == null) return null; - if (_discountAllocations is EqualUnmodifiableListView) return _discountAllocations; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); -} - final List? _discountCodes; @override List? get discountCodes { final value = _discountCodes; @@ -280,6 +285,9 @@ class _Cart extends Cart { } @override final CartBuyerIdentity? buyerIdentity; +/// Delivery addresses on the cart. Replaces the deprecated +/// `buyerIdentity.deliveryAddressPreferences`. +@override final CartDelivery? delivery; @override final String? note; @override final String? updatedAt; final List _lines; @@ -303,16 +311,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _Cart&&(identical(other.id, id) || other.id == id)&&(identical(other.checkoutUrl, checkoutUrl) || other.checkoutUrl == checkoutUrl)&&(identical(other.cost, cost) || other.cost == cost)&&(identical(other.totalQuantity, totalQuantity) || other.totalQuantity == totalQuantity)&&const DeepCollectionEquality().equals(other._discountAllocations, _discountAllocations)&&const DeepCollectionEquality().equals(other._discountCodes, _discountCodes)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&const DeepCollectionEquality().equals(other._attributes, _attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)&&(identical(other.note, note) || other.note == note)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&const DeepCollectionEquality().equals(other._lines, _lines)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Cart&&(identical(other.id, id) || other.id == id)&&(identical(other.checkoutUrl, checkoutUrl) || other.checkoutUrl == checkoutUrl)&&(identical(other.cost, cost) || other.cost == cost)&&(identical(other.totalQuantity, totalQuantity) || other.totalQuantity == totalQuantity)&&const DeepCollectionEquality().equals(other._discountCodes, _discountCodes)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&const DeepCollectionEquality().equals(other._attributes, _attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)&&(identical(other.delivery, delivery) || other.delivery == delivery)&&(identical(other.note, note) || other.note == note)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&const DeepCollectionEquality().equals(other._lines, _lines)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,checkoutUrl,cost,totalQuantity,const DeepCollectionEquality().hash(_discountAllocations),const DeepCollectionEquality().hash(_discountCodes),createdAt,const DeepCollectionEquality().hash(_attributes),buyerIdentity,note,updatedAt,const DeepCollectionEquality().hash(_lines)); +int get hashCode => Object.hash(runtimeType,id,checkoutUrl,cost,totalQuantity,const DeepCollectionEquality().hash(_discountCodes),createdAt,const DeepCollectionEquality().hash(_attributes),buyerIdentity,delivery,note,updatedAt,const DeepCollectionEquality().hash(_lines)); @override String toString() { - return 'Cart(id: $id, checkoutUrl: $checkoutUrl, cost: $cost, totalQuantity: $totalQuantity, discountAllocations: $discountAllocations, discountCodes: $discountCodes, createdAt: $createdAt, attributes: $attributes, buyerIdentity: $buyerIdentity, note: $note, updatedAt: $updatedAt, lines: $lines)'; + return 'Cart(id: $id, checkoutUrl: $checkoutUrl, cost: $cost, totalQuantity: $totalQuantity, discountCodes: $discountCodes, createdAt: $createdAt, attributes: $attributes, buyerIdentity: $buyerIdentity, delivery: $delivery, note: $note, updatedAt: $updatedAt, lines: $lines)'; } @@ -323,11 +331,11 @@ abstract mixin class _$CartCopyWith<$Res> implements $CartCopyWith<$Res> { factory _$CartCopyWith(_Cart value, $Res Function(_Cart) _then) = __$CartCopyWithImpl; @override @useResult $Res call({ - String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountAllocations, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, String? note, String? updatedAt,@JsonKey(fromJson: JsonHelper.lines) List lines + String id, String? checkoutUrl, CartCost? cost, int? totalQuantity, List? discountCodes, String? createdAt, List? attributes, CartBuyerIdentity? buyerIdentity, CartDelivery? delivery, String? note, String? updatedAt,@JsonKey(fromJson: JsonHelper.lines) List lines }); -@override $CartCostCopyWith<$Res>? get cost;@override $CartBuyerIdentityCopyWith<$Res>? get buyerIdentity; +@override $CartCostCopyWith<$Res>? get cost;@override $CartBuyerIdentityCopyWith<$Res>? get buyerIdentity;@override $CartDeliveryCopyWith<$Res>? get delivery; } /// @nodoc @@ -340,18 +348,18 @@ class __$CartCopyWithImpl<$Res> /// Create a copy of Cart /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? checkoutUrl = freezed,Object? cost = freezed,Object? totalQuantity = freezed,Object? discountAllocations = freezed,Object? discountCodes = freezed,Object? createdAt = freezed,Object? attributes = freezed,Object? buyerIdentity = freezed,Object? note = freezed,Object? updatedAt = freezed,Object? lines = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? checkoutUrl = freezed,Object? cost = freezed,Object? totalQuantity = freezed,Object? discountCodes = freezed,Object? createdAt = freezed,Object? attributes = freezed,Object? buyerIdentity = freezed,Object? delivery = freezed,Object? note = freezed,Object? updatedAt = freezed,Object? lines = null,}) { return _then(_Cart( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,checkoutUrl: freezed == checkoutUrl ? _self.checkoutUrl : checkoutUrl // ignore: cast_nullable_to_non_nullable as String?,cost: freezed == cost ? _self.cost : cost // ignore: cast_nullable_to_non_nullable as CartCost?,totalQuantity: freezed == totalQuantity ? _self.totalQuantity : totalQuantity // ignore: cast_nullable_to_non_nullable -as int?,discountAllocations: freezed == discountAllocations ? _self._discountAllocations : discountAllocations // ignore: cast_nullable_to_non_nullable -as List?,discountCodes: freezed == discountCodes ? _self._discountCodes : discountCodes // ignore: cast_nullable_to_non_nullable +as int?,discountCodes: freezed == discountCodes ? _self._discountCodes : discountCodes // ignore: cast_nullable_to_non_nullable as List?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as String?,attributes: freezed == attributes ? _self._attributes : attributes // ignore: cast_nullable_to_non_nullable as List?,buyerIdentity: freezed == buyerIdentity ? _self.buyerIdentity : buyerIdentity // ignore: cast_nullable_to_non_nullable -as CartBuyerIdentity?,note: freezed == note ? _self.note : note // ignore: cast_nullable_to_non_nullable +as CartBuyerIdentity?,delivery: freezed == delivery ? _self.delivery : delivery // ignore: cast_nullable_to_non_nullable +as CartDelivery?,note: freezed == note ? _self.note : note // ignore: cast_nullable_to_non_nullable as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as String?,lines: null == lines ? _self._lines : lines // ignore: cast_nullable_to_non_nullable as List, @@ -382,6 +390,18 @@ $CartBuyerIdentityCopyWith<$Res>? get buyerIdentity { return $CartBuyerIdentityCopyWith<$Res>(_self.buyerIdentity!, (value) { return _then(_self.copyWith(buyerIdentity: value)); }); +}/// Create a copy of Cart +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryCopyWith<$Res>? get delivery { + if (_self.delivery == null) { + return null; + } + + return $CartDeliveryCopyWith<$Res>(_self.delivery!, (value) { + return _then(_self.copyWith(delivery: value)); + }); } } diff --git a/lib/models/src/cart/cart.g.dart b/lib/models/src/cart/cart.g.dart index 045e6c68..f85f7591 100644 --- a/lib/models/src/cart/cart.g.dart +++ b/lib/models/src/cart/cart.g.dart @@ -13,13 +13,6 @@ _Cart _$CartFromJson(Map json) => _Cart( ? null : CartCost.fromJson(json['cost'] as Map), totalQuantity: (json['totalQuantity'] as num?)?.toInt(), - discountAllocations: (json['discountAllocations'] as List?) - ?.map( - (e) => e == null - ? null - : CartDiscountAllocation.fromJson(e as Map), - ) - .toList(), discountCodes: (json['discountCodes'] as List?) ?.map( (e) => e == null @@ -38,6 +31,9 @@ _Cart _$CartFromJson(Map json) => _Cart( : CartBuyerIdentity.fromJson( json['buyerIdentity'] as Map, ), + delivery: json['delivery'] == null + ? null + : CartDelivery.fromJson(json['delivery'] as Map), note: json['note'] as String?, updatedAt: json['updatedAt'] as String?, lines: JsonHelper.lines(json['lines']), @@ -48,13 +44,11 @@ Map _$CartToJson(_Cart instance) => { 'checkoutUrl': instance.checkoutUrl, 'cost': instance.cost?.toJson(), 'totalQuantity': instance.totalQuantity, - 'discountAllocations': instance.discountAllocations - ?.map((e) => e?.toJson()) - .toList(), 'discountCodes': instance.discountCodes?.map((e) => e?.toJson()).toList(), 'createdAt': instance.createdAt, 'attributes': instance.attributes?.map((e) => e?.toJson()).toList(), 'buyerIdentity': instance.buyerIdentity?.toJson(), + 'delivery': instance.delivery?.toJson(), 'note': instance.note, 'updatedAt': instance.updatedAt, 'lines': instance.lines.map((e) => e.toJson()).toList(), diff --git a/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.dart b/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.dart index e40c7bee..3457f68b 100644 --- a/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.dart +++ b/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.dart @@ -1,5 +1,4 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:shopify_flutter/models/src/checkout/mailing_address/mailing_address.dart'; import '../cart_preference/cart_preference.dart'; import '../customer/customer.dart'; @@ -20,7 +19,6 @@ abstract class CartBuyerIdentity with _$CartBuyerIdentity { String? countryCode, CartPreference? preferences, Customer? customer, - List? deliveryAddressPreferences, }) = _CartBuyerIdentity; /// cart buyer identity from json factory diff --git a/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.freezed.dart b/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.freezed.dart index 3ba6c47c..ebc76bc1 100644 --- a/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.freezed.dart +++ b/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$CartBuyerIdentity { - String? get email; String? get phone; String? get countryCode; CartPreference? get preferences; Customer? get customer; List? get deliveryAddressPreferences; + String? get email; String? get phone; String? get countryCode; CartPreference? get preferences; Customer? get customer; /// Create a copy of CartBuyerIdentity /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $CartBuyerIdentityCopyWith get copyWith => _$CartBuyerIdentit @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is CartBuyerIdentity&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.preferences, preferences) || other.preferences == preferences)&&(identical(other.customer, customer) || other.customer == customer)&&const DeepCollectionEquality().equals(other.deliveryAddressPreferences, deliveryAddressPreferences)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartBuyerIdentity&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.preferences, preferences) || other.preferences == preferences)&&(identical(other.customer, customer) || other.customer == customer)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,email,phone,countryCode,preferences,customer,const DeepCollectionEquality().hash(deliveryAddressPreferences)); +int get hashCode => Object.hash(runtimeType,email,phone,countryCode,preferences,customer); @override String toString() { - return 'CartBuyerIdentity(email: $email, phone: $phone, countryCode: $countryCode, preferences: $preferences, customer: $customer, deliveryAddressPreferences: $deliveryAddressPreferences)'; + return 'CartBuyerIdentity(email: $email, phone: $phone, countryCode: $countryCode, preferences: $preferences, customer: $customer)'; } @@ -48,7 +48,7 @@ abstract mixin class $CartBuyerIdentityCopyWith<$Res> { factory $CartBuyerIdentityCopyWith(CartBuyerIdentity value, $Res Function(CartBuyerIdentity) _then) = _$CartBuyerIdentityCopyWithImpl; @useResult $Res call({ - String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer, List? deliveryAddressPreferences + String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer }); @@ -65,15 +65,14 @@ class _$CartBuyerIdentityCopyWithImpl<$Res> /// Create a copy of CartBuyerIdentity /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? email = freezed,Object? phone = freezed,Object? countryCode = freezed,Object? preferences = freezed,Object? customer = freezed,Object? deliveryAddressPreferences = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? email = freezed,Object? phone = freezed,Object? countryCode = freezed,Object? preferences = freezed,Object? customer = freezed,}) { return _then(_self.copyWith( email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable as String?,preferences: freezed == preferences ? _self.preferences : preferences // ignore: cast_nullable_to_non_nullable as CartPreference?,customer: freezed == customer ? _self.customer : customer // ignore: cast_nullable_to_non_nullable -as Customer?,deliveryAddressPreferences: freezed == deliveryAddressPreferences ? _self.deliveryAddressPreferences : deliveryAddressPreferences // ignore: cast_nullable_to_non_nullable -as List?, +as Customer?, )); } /// Create a copy of CartBuyerIdentity @@ -182,10 +181,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer, List? deliveryAddressPreferences)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _CartBuyerIdentity() when $default != null: -return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_that.customer,_that.deliveryAddressPreferences);case _: +return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_that.customer);case _: return orElse(); } @@ -203,10 +202,10 @@ return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_tha /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer, List? deliveryAddressPreferences) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer) $default,) {final _that = this; switch (_that) { case _CartBuyerIdentity(): -return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_that.customer,_that.deliveryAddressPreferences);case _: +return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_that.customer);case _: throw StateError('Unexpected subclass'); } @@ -223,10 +222,10 @@ return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_tha /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer, List? deliveryAddressPreferences)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer)? $default,) {final _that = this; switch (_that) { case _CartBuyerIdentity() when $default != null: -return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_that.customer,_that.deliveryAddressPreferences);case _: +return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_that.customer);case _: return null; } @@ -238,7 +237,7 @@ return $default(_that.email,_that.phone,_that.countryCode,_that.preferences,_tha @JsonSerializable() class _CartBuyerIdentity extends CartBuyerIdentity { - const _CartBuyerIdentity({this.email, this.phone, this.countryCode, this.preferences, this.customer, final List? deliveryAddressPreferences}): _deliveryAddressPreferences = deliveryAddressPreferences,super._(); + const _CartBuyerIdentity({this.email, this.phone, this.countryCode, this.preferences, this.customer}): super._(); factory _CartBuyerIdentity.fromJson(Map json) => _$CartBuyerIdentityFromJson(json); @override final String? email; @@ -246,15 +245,6 @@ class _CartBuyerIdentity extends CartBuyerIdentity { @override final String? countryCode; @override final CartPreference? preferences; @override final Customer? customer; - final List? _deliveryAddressPreferences; -@override List? get deliveryAddressPreferences { - final value = _deliveryAddressPreferences; - if (value == null) return null; - if (_deliveryAddressPreferences is EqualUnmodifiableListView) return _deliveryAddressPreferences; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); -} - /// Create a copy of CartBuyerIdentity /// with the given fields replaced by the non-null parameter values. @@ -269,16 +259,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartBuyerIdentity&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.preferences, preferences) || other.preferences == preferences)&&(identical(other.customer, customer) || other.customer == customer)&&const DeepCollectionEquality().equals(other._deliveryAddressPreferences, _deliveryAddressPreferences)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartBuyerIdentity&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.preferences, preferences) || other.preferences == preferences)&&(identical(other.customer, customer) || other.customer == customer)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,email,phone,countryCode,preferences,customer,const DeepCollectionEquality().hash(_deliveryAddressPreferences)); +int get hashCode => Object.hash(runtimeType,email,phone,countryCode,preferences,customer); @override String toString() { - return 'CartBuyerIdentity(email: $email, phone: $phone, countryCode: $countryCode, preferences: $preferences, customer: $customer, deliveryAddressPreferences: $deliveryAddressPreferences)'; + return 'CartBuyerIdentity(email: $email, phone: $phone, countryCode: $countryCode, preferences: $preferences, customer: $customer)'; } @@ -289,7 +279,7 @@ abstract mixin class _$CartBuyerIdentityCopyWith<$Res> implements $CartBuyerIden factory _$CartBuyerIdentityCopyWith(_CartBuyerIdentity value, $Res Function(_CartBuyerIdentity) _then) = __$CartBuyerIdentityCopyWithImpl; @override @useResult $Res call({ - String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer, List? deliveryAddressPreferences + String? email, String? phone, String? countryCode, CartPreference? preferences, Customer? customer }); @@ -306,15 +296,14 @@ class __$CartBuyerIdentityCopyWithImpl<$Res> /// Create a copy of CartBuyerIdentity /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? email = freezed,Object? phone = freezed,Object? countryCode = freezed,Object? preferences = freezed,Object? customer = freezed,Object? deliveryAddressPreferences = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? email = freezed,Object? phone = freezed,Object? countryCode = freezed,Object? preferences = freezed,Object? customer = freezed,}) { return _then(_CartBuyerIdentity( email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable as String?,preferences: freezed == preferences ? _self.preferences : preferences // ignore: cast_nullable_to_non_nullable as CartPreference?,customer: freezed == customer ? _self.customer : customer // ignore: cast_nullable_to_non_nullable -as Customer?,deliveryAddressPreferences: freezed == deliveryAddressPreferences ? _self._deliveryAddressPreferences : deliveryAddressPreferences // ignore: cast_nullable_to_non_nullable -as List?, +as Customer?, )); } diff --git a/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.g.dart b/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.g.dart index 147c27cf..36171e24 100644 --- a/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.g.dart +++ b/lib/models/src/cart/cart_buyer_identity/cart_buyer_identity.g.dart @@ -19,14 +19,6 @@ _CartBuyerIdentity _$CartBuyerIdentityFromJson(Map json) => customer: json['customer'] == null ? null : Customer.fromJson(json['customer'] as Map), - deliveryAddressPreferences: - (json['deliveryAddressPreferences'] as List?) - ?.map( - (e) => e == null - ? null - : MailingAddress.fromJson(e as Map), - ) - .toList(), ); Map _$CartBuyerIdentityToJson(_CartBuyerIdentity instance) => @@ -36,7 +28,4 @@ Map _$CartBuyerIdentityToJson(_CartBuyerIdentity instance) => 'countryCode': instance.countryCode, 'preferences': instance.preferences?.toJson(), 'customer': instance.customer?.toJson(), - 'deliveryAddressPreferences': instance.deliveryAddressPreferences - ?.map((e) => e?.toJson()) - .toList(), }; diff --git a/lib/models/src/cart/cart_cost/cart_cost.dart b/lib/models/src/cart/cart_cost/cart_cost.dart index 8d408c5a..6a43bbc5 100644 --- a/lib/models/src/cart/cart_cost/cart_cost.dart +++ b/lib/models/src/cart/cart_cost/cart_cost.dart @@ -17,10 +17,6 @@ abstract class CartCost with _$CartCost { required bool subtotalAmountEstimated, required PriceV2 totalAmount, required bool totalAmountEstimated, - PriceV2? totalDutyAmount, - required bool totalDutyAmountEstimated, - PriceV2? totalTaxAmount, - required bool totalTaxAmountEstimated, }) = _CartCost; /// cart cost from json diff --git a/lib/models/src/cart/cart_cost/cart_cost.freezed.dart b/lib/models/src/cart/cart_cost/cart_cost.freezed.dart index 3da4c40b..5d7ad52c 100644 --- a/lib/models/src/cart/cart_cost/cart_cost.freezed.dart +++ b/lib/models/src/cart/cart_cost/cart_cost.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$CartCost { - PriceV2 get checkoutChargeAmount; PriceV2 get subtotalAmount; bool get subtotalAmountEstimated; PriceV2 get totalAmount; bool get totalAmountEstimated; PriceV2? get totalDutyAmount; bool get totalDutyAmountEstimated; PriceV2? get totalTaxAmount; bool get totalTaxAmountEstimated; + PriceV2 get checkoutChargeAmount; PriceV2 get subtotalAmount; bool get subtotalAmountEstimated; PriceV2 get totalAmount; bool get totalAmountEstimated; /// Create a copy of CartCost /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $CartCostCopyWith get copyWith => _$CartCostCopyWithImpl(thi @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is CartCost&&(identical(other.checkoutChargeAmount, checkoutChargeAmount) || other.checkoutChargeAmount == checkoutChargeAmount)&&(identical(other.subtotalAmount, subtotalAmount) || other.subtotalAmount == subtotalAmount)&&(identical(other.subtotalAmountEstimated, subtotalAmountEstimated) || other.subtotalAmountEstimated == subtotalAmountEstimated)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.totalAmountEstimated, totalAmountEstimated) || other.totalAmountEstimated == totalAmountEstimated)&&(identical(other.totalDutyAmount, totalDutyAmount) || other.totalDutyAmount == totalDutyAmount)&&(identical(other.totalDutyAmountEstimated, totalDutyAmountEstimated) || other.totalDutyAmountEstimated == totalDutyAmountEstimated)&&(identical(other.totalTaxAmount, totalTaxAmount) || other.totalTaxAmount == totalTaxAmount)&&(identical(other.totalTaxAmountEstimated, totalTaxAmountEstimated) || other.totalTaxAmountEstimated == totalTaxAmountEstimated)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartCost&&(identical(other.checkoutChargeAmount, checkoutChargeAmount) || other.checkoutChargeAmount == checkoutChargeAmount)&&(identical(other.subtotalAmount, subtotalAmount) || other.subtotalAmount == subtotalAmount)&&(identical(other.subtotalAmountEstimated, subtotalAmountEstimated) || other.subtotalAmountEstimated == subtotalAmountEstimated)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.totalAmountEstimated, totalAmountEstimated) || other.totalAmountEstimated == totalAmountEstimated)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,checkoutChargeAmount,subtotalAmount,subtotalAmountEstimated,totalAmount,totalAmountEstimated,totalDutyAmount,totalDutyAmountEstimated,totalTaxAmount,totalTaxAmountEstimated); +int get hashCode => Object.hash(runtimeType,checkoutChargeAmount,subtotalAmount,subtotalAmountEstimated,totalAmount,totalAmountEstimated); @override String toString() { - return 'CartCost(checkoutChargeAmount: $checkoutChargeAmount, subtotalAmount: $subtotalAmount, subtotalAmountEstimated: $subtotalAmountEstimated, totalAmount: $totalAmount, totalAmountEstimated: $totalAmountEstimated, totalDutyAmount: $totalDutyAmount, totalDutyAmountEstimated: $totalDutyAmountEstimated, totalTaxAmount: $totalTaxAmount, totalTaxAmountEstimated: $totalTaxAmountEstimated)'; + return 'CartCost(checkoutChargeAmount: $checkoutChargeAmount, subtotalAmount: $subtotalAmount, subtotalAmountEstimated: $subtotalAmountEstimated, totalAmount: $totalAmount, totalAmountEstimated: $totalAmountEstimated)'; } @@ -48,11 +48,11 @@ abstract mixin class $CartCostCopyWith<$Res> { factory $CartCostCopyWith(CartCost value, $Res Function(CartCost) _then) = _$CartCostCopyWithImpl; @useResult $Res call({ - PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated, PriceV2? totalDutyAmount, bool totalDutyAmountEstimated, PriceV2? totalTaxAmount, bool totalTaxAmountEstimated + PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated }); -$PriceV2CopyWith<$Res> get checkoutChargeAmount;$PriceV2CopyWith<$Res> get subtotalAmount;$PriceV2CopyWith<$Res> get totalAmount;$PriceV2CopyWith<$Res>? get totalDutyAmount;$PriceV2CopyWith<$Res>? get totalTaxAmount; +$PriceV2CopyWith<$Res> get checkoutChargeAmount;$PriceV2CopyWith<$Res> get subtotalAmount;$PriceV2CopyWith<$Res> get totalAmount; } /// @nodoc @@ -65,17 +65,13 @@ class _$CartCostCopyWithImpl<$Res> /// Create a copy of CartCost /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? checkoutChargeAmount = null,Object? subtotalAmount = null,Object? subtotalAmountEstimated = null,Object? totalAmount = null,Object? totalAmountEstimated = null,Object? totalDutyAmount = freezed,Object? totalDutyAmountEstimated = null,Object? totalTaxAmount = freezed,Object? totalTaxAmountEstimated = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? checkoutChargeAmount = null,Object? subtotalAmount = null,Object? subtotalAmountEstimated = null,Object? totalAmount = null,Object? totalAmountEstimated = null,}) { return _then(_self.copyWith( checkoutChargeAmount: null == checkoutChargeAmount ? _self.checkoutChargeAmount : checkoutChargeAmount // ignore: cast_nullable_to_non_nullable as PriceV2,subtotalAmount: null == subtotalAmount ? _self.subtotalAmount : subtotalAmount // ignore: cast_nullable_to_non_nullable as PriceV2,subtotalAmountEstimated: null == subtotalAmountEstimated ? _self.subtotalAmountEstimated : subtotalAmountEstimated // ignore: cast_nullable_to_non_nullable as bool,totalAmount: null == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable as PriceV2,totalAmountEstimated: null == totalAmountEstimated ? _self.totalAmountEstimated : totalAmountEstimated // ignore: cast_nullable_to_non_nullable -as bool,totalDutyAmount: freezed == totalDutyAmount ? _self.totalDutyAmount : totalDutyAmount // ignore: cast_nullable_to_non_nullable -as PriceV2?,totalDutyAmountEstimated: null == totalDutyAmountEstimated ? _self.totalDutyAmountEstimated : totalDutyAmountEstimated // ignore: cast_nullable_to_non_nullable -as bool,totalTaxAmount: freezed == totalTaxAmount ? _self.totalTaxAmount : totalTaxAmount // ignore: cast_nullable_to_non_nullable -as PriceV2?,totalTaxAmountEstimated: null == totalTaxAmountEstimated ? _self.totalTaxAmountEstimated : totalTaxAmountEstimated // ignore: cast_nullable_to_non_nullable as bool, )); } @@ -106,30 +102,6 @@ $PriceV2CopyWith<$Res> get totalAmount { return $PriceV2CopyWith<$Res>(_self.totalAmount, (value) { return _then(_self.copyWith(totalAmount: value)); }); -}/// Create a copy of CartCost -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res>? get totalDutyAmount { - if (_self.totalDutyAmount == null) { - return null; - } - - return $PriceV2CopyWith<$Res>(_self.totalDutyAmount!, (value) { - return _then(_self.copyWith(totalDutyAmount: value)); - }); -}/// Create a copy of CartCost -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res>? get totalTaxAmount { - if (_self.totalTaxAmount == null) { - return null; - } - - return $PriceV2CopyWith<$Res>(_self.totalTaxAmount!, (value) { - return _then(_self.copyWith(totalTaxAmount: value)); - }); } } @@ -212,10 +184,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated, PriceV2? totalDutyAmount, bool totalDutyAmountEstimated, PriceV2? totalTaxAmount, bool totalTaxAmountEstimated)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _CartCost() when $default != null: -return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAmountEstimated,_that.totalAmount,_that.totalAmountEstimated,_that.totalDutyAmount,_that.totalDutyAmountEstimated,_that.totalTaxAmount,_that.totalTaxAmountEstimated);case _: +return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAmountEstimated,_that.totalAmount,_that.totalAmountEstimated);case _: return orElse(); } @@ -233,10 +205,10 @@ return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAm /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated, PriceV2? totalDutyAmount, bool totalDutyAmountEstimated, PriceV2? totalTaxAmount, bool totalTaxAmountEstimated) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated) $default,) {final _that = this; switch (_that) { case _CartCost(): -return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAmountEstimated,_that.totalAmount,_that.totalAmountEstimated,_that.totalDutyAmount,_that.totalDutyAmountEstimated,_that.totalTaxAmount,_that.totalTaxAmountEstimated);case _: +return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAmountEstimated,_that.totalAmount,_that.totalAmountEstimated);case _: throw StateError('Unexpected subclass'); } @@ -253,10 +225,10 @@ return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAm /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated, PriceV2? totalDutyAmount, bool totalDutyAmountEstimated, PriceV2? totalTaxAmount, bool totalTaxAmountEstimated)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated)? $default,) {final _that = this; switch (_that) { case _CartCost() when $default != null: -return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAmountEstimated,_that.totalAmount,_that.totalAmountEstimated,_that.totalDutyAmount,_that.totalDutyAmountEstimated,_that.totalTaxAmount,_that.totalTaxAmountEstimated);case _: +return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAmountEstimated,_that.totalAmount,_that.totalAmountEstimated);case _: return null; } @@ -268,7 +240,7 @@ return $default(_that.checkoutChargeAmount,_that.subtotalAmount,_that.subtotalAm @JsonSerializable() class _CartCost extends CartCost { - const _CartCost({required this.checkoutChargeAmount, required this.subtotalAmount, required this.subtotalAmountEstimated, required this.totalAmount, required this.totalAmountEstimated, this.totalDutyAmount, required this.totalDutyAmountEstimated, this.totalTaxAmount, required this.totalTaxAmountEstimated}): super._(); + const _CartCost({required this.checkoutChargeAmount, required this.subtotalAmount, required this.subtotalAmountEstimated, required this.totalAmount, required this.totalAmountEstimated}): super._(); factory _CartCost.fromJson(Map json) => _$CartCostFromJson(json); @override final PriceV2 checkoutChargeAmount; @@ -276,10 +248,6 @@ class _CartCost extends CartCost { @override final bool subtotalAmountEstimated; @override final PriceV2 totalAmount; @override final bool totalAmountEstimated; -@override final PriceV2? totalDutyAmount; -@override final bool totalDutyAmountEstimated; -@override final PriceV2? totalTaxAmount; -@override final bool totalTaxAmountEstimated; /// Create a copy of CartCost /// with the given fields replaced by the non-null parameter values. @@ -294,16 +262,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartCost&&(identical(other.checkoutChargeAmount, checkoutChargeAmount) || other.checkoutChargeAmount == checkoutChargeAmount)&&(identical(other.subtotalAmount, subtotalAmount) || other.subtotalAmount == subtotalAmount)&&(identical(other.subtotalAmountEstimated, subtotalAmountEstimated) || other.subtotalAmountEstimated == subtotalAmountEstimated)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.totalAmountEstimated, totalAmountEstimated) || other.totalAmountEstimated == totalAmountEstimated)&&(identical(other.totalDutyAmount, totalDutyAmount) || other.totalDutyAmount == totalDutyAmount)&&(identical(other.totalDutyAmountEstimated, totalDutyAmountEstimated) || other.totalDutyAmountEstimated == totalDutyAmountEstimated)&&(identical(other.totalTaxAmount, totalTaxAmount) || other.totalTaxAmount == totalTaxAmount)&&(identical(other.totalTaxAmountEstimated, totalTaxAmountEstimated) || other.totalTaxAmountEstimated == totalTaxAmountEstimated)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartCost&&(identical(other.checkoutChargeAmount, checkoutChargeAmount) || other.checkoutChargeAmount == checkoutChargeAmount)&&(identical(other.subtotalAmount, subtotalAmount) || other.subtotalAmount == subtotalAmount)&&(identical(other.subtotalAmountEstimated, subtotalAmountEstimated) || other.subtotalAmountEstimated == subtotalAmountEstimated)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.totalAmountEstimated, totalAmountEstimated) || other.totalAmountEstimated == totalAmountEstimated)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,checkoutChargeAmount,subtotalAmount,subtotalAmountEstimated,totalAmount,totalAmountEstimated,totalDutyAmount,totalDutyAmountEstimated,totalTaxAmount,totalTaxAmountEstimated); +int get hashCode => Object.hash(runtimeType,checkoutChargeAmount,subtotalAmount,subtotalAmountEstimated,totalAmount,totalAmountEstimated); @override String toString() { - return 'CartCost(checkoutChargeAmount: $checkoutChargeAmount, subtotalAmount: $subtotalAmount, subtotalAmountEstimated: $subtotalAmountEstimated, totalAmount: $totalAmount, totalAmountEstimated: $totalAmountEstimated, totalDutyAmount: $totalDutyAmount, totalDutyAmountEstimated: $totalDutyAmountEstimated, totalTaxAmount: $totalTaxAmount, totalTaxAmountEstimated: $totalTaxAmountEstimated)'; + return 'CartCost(checkoutChargeAmount: $checkoutChargeAmount, subtotalAmount: $subtotalAmount, subtotalAmountEstimated: $subtotalAmountEstimated, totalAmount: $totalAmount, totalAmountEstimated: $totalAmountEstimated)'; } @@ -314,11 +282,11 @@ abstract mixin class _$CartCostCopyWith<$Res> implements $CartCostCopyWith<$Res> factory _$CartCostCopyWith(_CartCost value, $Res Function(_CartCost) _then) = __$CartCostCopyWithImpl; @override @useResult $Res call({ - PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated, PriceV2? totalDutyAmount, bool totalDutyAmountEstimated, PriceV2? totalTaxAmount, bool totalTaxAmountEstimated + PriceV2 checkoutChargeAmount, PriceV2 subtotalAmount, bool subtotalAmountEstimated, PriceV2 totalAmount, bool totalAmountEstimated }); -@override $PriceV2CopyWith<$Res> get checkoutChargeAmount;@override $PriceV2CopyWith<$Res> get subtotalAmount;@override $PriceV2CopyWith<$Res> get totalAmount;@override $PriceV2CopyWith<$Res>? get totalDutyAmount;@override $PriceV2CopyWith<$Res>? get totalTaxAmount; +@override $PriceV2CopyWith<$Res> get checkoutChargeAmount;@override $PriceV2CopyWith<$Res> get subtotalAmount;@override $PriceV2CopyWith<$Res> get totalAmount; } /// @nodoc @@ -331,17 +299,13 @@ class __$CartCostCopyWithImpl<$Res> /// Create a copy of CartCost /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? checkoutChargeAmount = null,Object? subtotalAmount = null,Object? subtotalAmountEstimated = null,Object? totalAmount = null,Object? totalAmountEstimated = null,Object? totalDutyAmount = freezed,Object? totalDutyAmountEstimated = null,Object? totalTaxAmount = freezed,Object? totalTaxAmountEstimated = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? checkoutChargeAmount = null,Object? subtotalAmount = null,Object? subtotalAmountEstimated = null,Object? totalAmount = null,Object? totalAmountEstimated = null,}) { return _then(_CartCost( checkoutChargeAmount: null == checkoutChargeAmount ? _self.checkoutChargeAmount : checkoutChargeAmount // ignore: cast_nullable_to_non_nullable as PriceV2,subtotalAmount: null == subtotalAmount ? _self.subtotalAmount : subtotalAmount // ignore: cast_nullable_to_non_nullable as PriceV2,subtotalAmountEstimated: null == subtotalAmountEstimated ? _self.subtotalAmountEstimated : subtotalAmountEstimated // ignore: cast_nullable_to_non_nullable as bool,totalAmount: null == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable as PriceV2,totalAmountEstimated: null == totalAmountEstimated ? _self.totalAmountEstimated : totalAmountEstimated // ignore: cast_nullable_to_non_nullable -as bool,totalDutyAmount: freezed == totalDutyAmount ? _self.totalDutyAmount : totalDutyAmount // ignore: cast_nullable_to_non_nullable -as PriceV2?,totalDutyAmountEstimated: null == totalDutyAmountEstimated ? _self.totalDutyAmountEstimated : totalDutyAmountEstimated // ignore: cast_nullable_to_non_nullable -as bool,totalTaxAmount: freezed == totalTaxAmount ? _self.totalTaxAmount : totalTaxAmount // ignore: cast_nullable_to_non_nullable -as PriceV2?,totalTaxAmountEstimated: null == totalTaxAmountEstimated ? _self.totalTaxAmountEstimated : totalTaxAmountEstimated // ignore: cast_nullable_to_non_nullable as bool, )); } @@ -373,30 +337,6 @@ $PriceV2CopyWith<$Res> get totalAmount { return $PriceV2CopyWith<$Res>(_self.totalAmount, (value) { return _then(_self.copyWith(totalAmount: value)); }); -}/// Create a copy of CartCost -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res>? get totalDutyAmount { - if (_self.totalDutyAmount == null) { - return null; - } - - return $PriceV2CopyWith<$Res>(_self.totalDutyAmount!, (value) { - return _then(_self.copyWith(totalDutyAmount: value)); - }); -}/// Create a copy of CartCost -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res>? get totalTaxAmount { - if (_self.totalTaxAmount == null) { - return null; - } - - return $PriceV2CopyWith<$Res>(_self.totalTaxAmount!, (value) { - return _then(_self.copyWith(totalTaxAmount: value)); - }); } } diff --git a/lib/models/src/cart/cart_cost/cart_cost.g.dart b/lib/models/src/cart/cart_cost/cart_cost.g.dart index 954304b3..58b40001 100644 --- a/lib/models/src/cart/cart_cost/cart_cost.g.dart +++ b/lib/models/src/cart/cart_cost/cart_cost.g.dart @@ -16,14 +16,6 @@ _CartCost _$CartCostFromJson(Map json) => _CartCost( subtotalAmountEstimated: json['subtotalAmountEstimated'] as bool, totalAmount: PriceV2.fromJson(json['totalAmount'] as Map), totalAmountEstimated: json['totalAmountEstimated'] as bool, - totalDutyAmount: json['totalDutyAmount'] == null - ? null - : PriceV2.fromJson(json['totalDutyAmount'] as Map), - totalDutyAmountEstimated: json['totalDutyAmountEstimated'] as bool, - totalTaxAmount: json['totalTaxAmount'] == null - ? null - : PriceV2.fromJson(json['totalTaxAmount'] as Map), - totalTaxAmountEstimated: json['totalTaxAmountEstimated'] as bool, ); Map _$CartCostToJson(_CartCost instance) => { @@ -32,8 +24,4 @@ Map _$CartCostToJson(_CartCost instance) => { 'subtotalAmountEstimated': instance.subtotalAmountEstimated, 'totalAmount': instance.totalAmount.toJson(), 'totalAmountEstimated': instance.totalAmountEstimated, - 'totalDutyAmount': instance.totalDutyAmount?.toJson(), - 'totalDutyAmountEstimated': instance.totalDutyAmountEstimated, - 'totalTaxAmount': instance.totalTaxAmount?.toJson(), - 'totalTaxAmountEstimated': instance.totalTaxAmountEstimated, }; diff --git a/lib/models/src/cart/cart_delivery/cart_delivery.dart b/lib/models/src/cart/cart_delivery/cart_delivery.dart new file mode 100644 index 00000000..3f2dcb70 --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_delivery.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:shopify_flutter/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.dart'; + +part 'cart_delivery.freezed.dart'; +part 'cart_delivery.g.dart'; + +@freezed + +/// The delivery information of a cart. +/// +/// Replaces the deprecated `CartBuyerIdentity.deliveryAddressPreferences`. +abstract class CartDelivery with _$CartDelivery { + const CartDelivery._(); + + /// The CartDelivery constructor + const factory CartDelivery({ + @Default([]) List addresses, + }) = _CartDelivery; + + /// The CartDelivery from json + factory CartDelivery.fromJson(Map json) => + _$CartDeliveryFromJson(json); +} diff --git a/lib/models/src/cart/cart_delivery/cart_delivery.freezed.dart b/lib/models/src/cart/cart_delivery/cart_delivery.freezed.dart new file mode 100644 index 00000000..aa4bb4d1 --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_delivery.freezed.dart @@ -0,0 +1,283 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cart_delivery.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$CartDelivery { + + List get addresses; +/// Create a copy of CartDelivery +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CartDeliveryCopyWith get copyWith => _$CartDeliveryCopyWithImpl(this as CartDelivery, _$identity); + + /// Serializes this CartDelivery to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartDelivery&&const DeepCollectionEquality().equals(other.addresses, addresses)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(addresses)); + +@override +String toString() { + return 'CartDelivery(addresses: $addresses)'; +} + + +} + +/// @nodoc +abstract mixin class $CartDeliveryCopyWith<$Res> { + factory $CartDeliveryCopyWith(CartDelivery value, $Res Function(CartDelivery) _then) = _$CartDeliveryCopyWithImpl; +@useResult +$Res call({ + List addresses +}); + + + + +} +/// @nodoc +class _$CartDeliveryCopyWithImpl<$Res> + implements $CartDeliveryCopyWith<$Res> { + _$CartDeliveryCopyWithImpl(this._self, this._then); + + final CartDelivery _self; + final $Res Function(CartDelivery) _then; + +/// Create a copy of CartDelivery +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? addresses = null,}) { + return _then(_self.copyWith( +addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [CartDelivery]. +extension CartDeliveryPatterns on CartDelivery { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _CartDelivery value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CartDelivery() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _CartDelivery value) $default,){ +final _that = this; +switch (_that) { +case _CartDelivery(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CartDelivery value)? $default,){ +final _that = this; +switch (_that) { +case _CartDelivery() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( List addresses)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CartDelivery() when $default != null: +return $default(_that.addresses);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( List addresses) $default,) {final _that = this; +switch (_that) { +case _CartDelivery(): +return $default(_that.addresses);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List addresses)? $default,) {final _that = this; +switch (_that) { +case _CartDelivery() when $default != null: +return $default(_that.addresses);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _CartDelivery extends CartDelivery { + const _CartDelivery({final List addresses = const []}): _addresses = addresses,super._(); + factory _CartDelivery.fromJson(Map json) => _$CartDeliveryFromJson(json); + + final List _addresses; +@override@JsonKey() List get addresses { + if (_addresses is EqualUnmodifiableListView) return _addresses; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_addresses); +} + + +/// Create a copy of CartDelivery +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CartDeliveryCopyWith<_CartDelivery> get copyWith => __$CartDeliveryCopyWithImpl<_CartDelivery>(this, _$identity); + +@override +Map toJson() { + return _$CartDeliveryToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartDelivery&&const DeepCollectionEquality().equals(other._addresses, _addresses)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_addresses)); + +@override +String toString() { + return 'CartDelivery(addresses: $addresses)'; +} + + +} + +/// @nodoc +abstract mixin class _$CartDeliveryCopyWith<$Res> implements $CartDeliveryCopyWith<$Res> { + factory _$CartDeliveryCopyWith(_CartDelivery value, $Res Function(_CartDelivery) _then) = __$CartDeliveryCopyWithImpl; +@override @useResult +$Res call({ + List addresses +}); + + + + +} +/// @nodoc +class __$CartDeliveryCopyWithImpl<$Res> + implements _$CartDeliveryCopyWith<$Res> { + __$CartDeliveryCopyWithImpl(this._self, this._then); + + final _CartDelivery _self; + final $Res Function(_CartDelivery) _then; + +/// Create a copy of CartDelivery +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? addresses = null,}) { + return _then(_CartDelivery( +addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +// dart format on diff --git a/lib/models/src/cart/cart_delivery/cart_delivery.g.dart b/lib/models/src/cart/cart_delivery/cart_delivery.g.dart new file mode 100644 index 00000000..75a1aafb --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_delivery.g.dart @@ -0,0 +1,24 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cart_delivery.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CartDelivery _$CartDeliveryFromJson(Map json) => + _CartDelivery( + addresses: + (json['addresses'] as List?) + ?.map( + (e) => + CartSelectableAddress.fromJson(e as Map), + ) + .toList() ?? + const [], + ); + +Map _$CartDeliveryToJson(_CartDelivery instance) => + { + 'addresses': instance.addresses.map((e) => e.toJson()).toList(), + }; diff --git a/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.dart b/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.dart new file mode 100644 index 00000000..18678672 --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.dart @@ -0,0 +1,39 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'cart_delivery_address.freezed.dart'; +part 'cart_delivery_address.g.dart'; + +@freezed + +/// A delivery address stored on the cart. +/// +/// Replaces the deprecated `CartBuyerIdentity.deliveryAddressPreferences` +/// (which returned `MailingAddress`). Note that this type exposes +/// [countryCode] and [provinceCode] rather than the full country/province +/// names. +abstract class CartDeliveryAddress with _$CartDeliveryAddress { + const CartDeliveryAddress._(); + + /// The CartDeliveryAddress constructor + const factory CartDeliveryAddress({ + String? address1, + String? address2, + String? city, + String? company, + String? countryCode, + String? firstName, + String? lastName, + String? name, + String? phone, + String? provinceCode, + String? zip, + String? formattedArea, + double? latitude, + double? longitude, + @Default([]) List formatted, + }) = _CartDeliveryAddress; + + /// The CartDeliveryAddress from json + factory CartDeliveryAddress.fromJson(Map json) => + _$CartDeliveryAddressFromJson(json); +} diff --git a/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.freezed.dart b/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.freezed.dart new file mode 100644 index 00000000..2a33b0f0 --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.freezed.dart @@ -0,0 +1,325 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cart_delivery_address.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$CartDeliveryAddress { + + String? get address1; String? get address2; String? get city; String? get company; String? get countryCode; String? get firstName; String? get lastName; String? get name; String? get phone; String? get provinceCode; String? get zip; String? get formattedArea; double? get latitude; double? get longitude; List get formatted; +/// Create a copy of CartDeliveryAddress +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CartDeliveryAddressCopyWith get copyWith => _$CartDeliveryAddressCopyWithImpl(this as CartDeliveryAddress, _$identity); + + /// Serializes this CartDeliveryAddress to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartDeliveryAddress&&(identical(other.address1, address1) || other.address1 == address1)&&(identical(other.address2, address2) || other.address2 == address2)&&(identical(other.city, city) || other.city == city)&&(identical(other.company, company) || other.company == company)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.provinceCode, provinceCode) || other.provinceCode == provinceCode)&&(identical(other.zip, zip) || other.zip == zip)&&(identical(other.formattedArea, formattedArea) || other.formattedArea == formattedArea)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&const DeepCollectionEquality().equals(other.formatted, formatted)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,address1,address2,city,company,countryCode,firstName,lastName,name,phone,provinceCode,zip,formattedArea,latitude,longitude,const DeepCollectionEquality().hash(formatted)); + +@override +String toString() { + return 'CartDeliveryAddress(address1: $address1, address2: $address2, city: $city, company: $company, countryCode: $countryCode, firstName: $firstName, lastName: $lastName, name: $name, phone: $phone, provinceCode: $provinceCode, zip: $zip, formattedArea: $formattedArea, latitude: $latitude, longitude: $longitude, formatted: $formatted)'; +} + + +} + +/// @nodoc +abstract mixin class $CartDeliveryAddressCopyWith<$Res> { + factory $CartDeliveryAddressCopyWith(CartDeliveryAddress value, $Res Function(CartDeliveryAddress) _then) = _$CartDeliveryAddressCopyWithImpl; +@useResult +$Res call({ + String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? name, String? phone, String? provinceCode, String? zip, String? formattedArea, double? latitude, double? longitude, List formatted +}); + + + + +} +/// @nodoc +class _$CartDeliveryAddressCopyWithImpl<$Res> + implements $CartDeliveryAddressCopyWith<$Res> { + _$CartDeliveryAddressCopyWithImpl(this._self, this._then); + + final CartDeliveryAddress _self; + final $Res Function(CartDeliveryAddress) _then; + +/// Create a copy of CartDeliveryAddress +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? address1 = freezed,Object? address2 = freezed,Object? city = freezed,Object? company = freezed,Object? countryCode = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? name = freezed,Object? phone = freezed,Object? provinceCode = freezed,Object? zip = freezed,Object? formattedArea = freezed,Object? latitude = freezed,Object? longitude = freezed,Object? formatted = null,}) { + return _then(_self.copyWith( +address1: freezed == address1 ? _self.address1 : address1 // ignore: cast_nullable_to_non_nullable +as String?,address2: freezed == address2 ? _self.address2 : address2 // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,company: freezed == company ? _self.company : company // ignore: cast_nullable_to_non_nullable +as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?,provinceCode: freezed == provinceCode ? _self.provinceCode : provinceCode // ignore: cast_nullable_to_non_nullable +as String?,zip: freezed == zip ? _self.zip : zip // ignore: cast_nullable_to_non_nullable +as String?,formattedArea: freezed == formattedArea ? _self.formattedArea : formattedArea // ignore: cast_nullable_to_non_nullable +as String?,latitude: freezed == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double?,longitude: freezed == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double?,formatted: null == formatted ? _self.formatted : formatted // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [CartDeliveryAddress]. +extension CartDeliveryAddressPatterns on CartDeliveryAddress { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _CartDeliveryAddress value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CartDeliveryAddress() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _CartDeliveryAddress value) $default,){ +final _that = this; +switch (_that) { +case _CartDeliveryAddress(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CartDeliveryAddress value)? $default,){ +final _that = this; +switch (_that) { +case _CartDeliveryAddress() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? name, String? phone, String? provinceCode, String? zip, String? formattedArea, double? latitude, double? longitude, List formatted)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CartDeliveryAddress() when $default != null: +return $default(_that.address1,_that.address2,_that.city,_that.company,_that.countryCode,_that.firstName,_that.lastName,_that.name,_that.phone,_that.provinceCode,_that.zip,_that.formattedArea,_that.latitude,_that.longitude,_that.formatted);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? name, String? phone, String? provinceCode, String? zip, String? formattedArea, double? latitude, double? longitude, List formatted) $default,) {final _that = this; +switch (_that) { +case _CartDeliveryAddress(): +return $default(_that.address1,_that.address2,_that.city,_that.company,_that.countryCode,_that.firstName,_that.lastName,_that.name,_that.phone,_that.provinceCode,_that.zip,_that.formattedArea,_that.latitude,_that.longitude,_that.formatted);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? name, String? phone, String? provinceCode, String? zip, String? formattedArea, double? latitude, double? longitude, List formatted)? $default,) {final _that = this; +switch (_that) { +case _CartDeliveryAddress() when $default != null: +return $default(_that.address1,_that.address2,_that.city,_that.company,_that.countryCode,_that.firstName,_that.lastName,_that.name,_that.phone,_that.provinceCode,_that.zip,_that.formattedArea,_that.latitude,_that.longitude,_that.formatted);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _CartDeliveryAddress extends CartDeliveryAddress { + const _CartDeliveryAddress({this.address1, this.address2, this.city, this.company, this.countryCode, this.firstName, this.lastName, this.name, this.phone, this.provinceCode, this.zip, this.formattedArea, this.latitude, this.longitude, final List formatted = const []}): _formatted = formatted,super._(); + factory _CartDeliveryAddress.fromJson(Map json) => _$CartDeliveryAddressFromJson(json); + +@override final String? address1; +@override final String? address2; +@override final String? city; +@override final String? company; +@override final String? countryCode; +@override final String? firstName; +@override final String? lastName; +@override final String? name; +@override final String? phone; +@override final String? provinceCode; +@override final String? zip; +@override final String? formattedArea; +@override final double? latitude; +@override final double? longitude; + final List _formatted; +@override@JsonKey() List get formatted { + if (_formatted is EqualUnmodifiableListView) return _formatted; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_formatted); +} + + +/// Create a copy of CartDeliveryAddress +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CartDeliveryAddressCopyWith<_CartDeliveryAddress> get copyWith => __$CartDeliveryAddressCopyWithImpl<_CartDeliveryAddress>(this, _$identity); + +@override +Map toJson() { + return _$CartDeliveryAddressToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartDeliveryAddress&&(identical(other.address1, address1) || other.address1 == address1)&&(identical(other.address2, address2) || other.address2 == address2)&&(identical(other.city, city) || other.city == city)&&(identical(other.company, company) || other.company == company)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.provinceCode, provinceCode) || other.provinceCode == provinceCode)&&(identical(other.zip, zip) || other.zip == zip)&&(identical(other.formattedArea, formattedArea) || other.formattedArea == formattedArea)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&const DeepCollectionEquality().equals(other._formatted, _formatted)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,address1,address2,city,company,countryCode,firstName,lastName,name,phone,provinceCode,zip,formattedArea,latitude,longitude,const DeepCollectionEquality().hash(_formatted)); + +@override +String toString() { + return 'CartDeliveryAddress(address1: $address1, address2: $address2, city: $city, company: $company, countryCode: $countryCode, firstName: $firstName, lastName: $lastName, name: $name, phone: $phone, provinceCode: $provinceCode, zip: $zip, formattedArea: $formattedArea, latitude: $latitude, longitude: $longitude, formatted: $formatted)'; +} + + +} + +/// @nodoc +abstract mixin class _$CartDeliveryAddressCopyWith<$Res> implements $CartDeliveryAddressCopyWith<$Res> { + factory _$CartDeliveryAddressCopyWith(_CartDeliveryAddress value, $Res Function(_CartDeliveryAddress) _then) = __$CartDeliveryAddressCopyWithImpl; +@override @useResult +$Res call({ + String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? name, String? phone, String? provinceCode, String? zip, String? formattedArea, double? latitude, double? longitude, List formatted +}); + + + + +} +/// @nodoc +class __$CartDeliveryAddressCopyWithImpl<$Res> + implements _$CartDeliveryAddressCopyWith<$Res> { + __$CartDeliveryAddressCopyWithImpl(this._self, this._then); + + final _CartDeliveryAddress _self; + final $Res Function(_CartDeliveryAddress) _then; + +/// Create a copy of CartDeliveryAddress +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? address1 = freezed,Object? address2 = freezed,Object? city = freezed,Object? company = freezed,Object? countryCode = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? name = freezed,Object? phone = freezed,Object? provinceCode = freezed,Object? zip = freezed,Object? formattedArea = freezed,Object? latitude = freezed,Object? longitude = freezed,Object? formatted = null,}) { + return _then(_CartDeliveryAddress( +address1: freezed == address1 ? _self.address1 : address1 // ignore: cast_nullable_to_non_nullable +as String?,address2: freezed == address2 ? _self.address2 : address2 // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,company: freezed == company ? _self.company : company // ignore: cast_nullable_to_non_nullable +as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?,provinceCode: freezed == provinceCode ? _self.provinceCode : provinceCode // ignore: cast_nullable_to_non_nullable +as String?,zip: freezed == zip ? _self.zip : zip // ignore: cast_nullable_to_non_nullable +as String?,formattedArea: freezed == formattedArea ? _self.formattedArea : formattedArea // ignore: cast_nullable_to_non_nullable +as String?,latitude: freezed == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double?,longitude: freezed == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double?,formatted: null == formatted ? _self._formatted : formatted // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +// dart format on diff --git a/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.g.dart b/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.g.dart new file mode 100644 index 00000000..faf7ea8c --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.g.dart @@ -0,0 +1,50 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cart_delivery_address.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CartDeliveryAddress _$CartDeliveryAddressFromJson(Map json) => + _CartDeliveryAddress( + address1: json['address1'] as String?, + address2: json['address2'] as String?, + city: json['city'] as String?, + company: json['company'] as String?, + countryCode: json['countryCode'] as String?, + firstName: json['firstName'] as String?, + lastName: json['lastName'] as String?, + name: json['name'] as String?, + phone: json['phone'] as String?, + provinceCode: json['provinceCode'] as String?, + zip: json['zip'] as String?, + formattedArea: json['formattedArea'] as String?, + latitude: (json['latitude'] as num?)?.toDouble(), + longitude: (json['longitude'] as num?)?.toDouble(), + formatted: + (json['formatted'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + ); + +Map _$CartDeliveryAddressToJson( + _CartDeliveryAddress instance, +) => { + 'address1': instance.address1, + 'address2': instance.address2, + 'city': instance.city, + 'company': instance.company, + 'countryCode': instance.countryCode, + 'firstName': instance.firstName, + 'lastName': instance.lastName, + 'name': instance.name, + 'phone': instance.phone, + 'provinceCode': instance.provinceCode, + 'zip': instance.zip, + 'formattedArea': instance.formattedArea, + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'formatted': instance.formatted, +}; diff --git a/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.dart b/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.dart new file mode 100644 index 00000000..26f375ad --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.dart @@ -0,0 +1,31 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:shopify_flutter/models/src/cart/cart_delivery/cart_delivery_address/cart_delivery_address.dart'; + +part 'cart_selectable_address.freezed.dart'; +part 'cart_selectable_address.g.dart'; + +@freezed + +/// A delivery address presented to the buyer on the cart, along with whether it +/// is the pre-selected one. +abstract class CartSelectableAddress with _$CartSelectableAddress { + const CartSelectableAddress._(); + + /// The CartSelectableAddress constructor + const factory CartSelectableAddress({ + required String id, + required CartDeliveryAddress address, + + /// Whether this address is pre-selected for the buyer. Exactly one address + /// on a cart can be selected. + bool? selected, + + /// Whether this address is dropped after a successful checkout rather than + /// being associated with the buyer. + bool? oneTimeUse, + }) = _CartSelectableAddress; + + /// The CartSelectableAddress from json + factory CartSelectableAddress.fromJson(Map json) => + _$CartSelectableAddressFromJson(json); +} diff --git a/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.freezed.dart b/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.freezed.dart new file mode 100644 index 00000000..804717d3 --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.freezed.dart @@ -0,0 +1,312 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cart_selectable_address.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$CartSelectableAddress { + + String get id; CartDeliveryAddress get address;/// Whether this address is pre-selected for the buyer. Exactly one address +/// on a cart can be selected. + bool? get selected;/// Whether this address is dropped after a successful checkout rather than +/// being associated with the buyer. + bool? get oneTimeUse; +/// Create a copy of CartSelectableAddress +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CartSelectableAddressCopyWith get copyWith => _$CartSelectableAddressCopyWithImpl(this as CartSelectableAddress, _$identity); + + /// Serializes this CartSelectableAddress to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartSelectableAddress&&(identical(other.id, id) || other.id == id)&&(identical(other.address, address) || other.address == address)&&(identical(other.selected, selected) || other.selected == selected)&&(identical(other.oneTimeUse, oneTimeUse) || other.oneTimeUse == oneTimeUse)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,address,selected,oneTimeUse); + +@override +String toString() { + return 'CartSelectableAddress(id: $id, address: $address, selected: $selected, oneTimeUse: $oneTimeUse)'; +} + + +} + +/// @nodoc +abstract mixin class $CartSelectableAddressCopyWith<$Res> { + factory $CartSelectableAddressCopyWith(CartSelectableAddress value, $Res Function(CartSelectableAddress) _then) = _$CartSelectableAddressCopyWithImpl; +@useResult +$Res call({ + String id, CartDeliveryAddress address, bool? selected, bool? oneTimeUse +}); + + +$CartDeliveryAddressCopyWith<$Res> get address; + +} +/// @nodoc +class _$CartSelectableAddressCopyWithImpl<$Res> + implements $CartSelectableAddressCopyWith<$Res> { + _$CartSelectableAddressCopyWithImpl(this._self, this._then); + + final CartSelectableAddress _self; + final $Res Function(CartSelectableAddress) _then; + +/// Create a copy of CartSelectableAddress +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? address = null,Object? selected = freezed,Object? oneTimeUse = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as CartDeliveryAddress,selected: freezed == selected ? _self.selected : selected // ignore: cast_nullable_to_non_nullable +as bool?,oneTimeUse: freezed == oneTimeUse ? _self.oneTimeUse : oneTimeUse // ignore: cast_nullable_to_non_nullable +as bool?, + )); +} +/// Create a copy of CartSelectableAddress +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryAddressCopyWith<$Res> get address { + + return $CartDeliveryAddressCopyWith<$Res>(_self.address, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [CartSelectableAddress]. +extension CartSelectableAddressPatterns on CartSelectableAddress { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _CartSelectableAddress value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CartSelectableAddress() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _CartSelectableAddress value) $default,){ +final _that = this; +switch (_that) { +case _CartSelectableAddress(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CartSelectableAddress value)? $default,){ +final _that = this; +switch (_that) { +case _CartSelectableAddress() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, CartDeliveryAddress address, bool? selected, bool? oneTimeUse)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CartSelectableAddress() when $default != null: +return $default(_that.id,_that.address,_that.selected,_that.oneTimeUse);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String id, CartDeliveryAddress address, bool? selected, bool? oneTimeUse) $default,) {final _that = this; +switch (_that) { +case _CartSelectableAddress(): +return $default(_that.id,_that.address,_that.selected,_that.oneTimeUse);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, CartDeliveryAddress address, bool? selected, bool? oneTimeUse)? $default,) {final _that = this; +switch (_that) { +case _CartSelectableAddress() when $default != null: +return $default(_that.id,_that.address,_that.selected,_that.oneTimeUse);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _CartSelectableAddress extends CartSelectableAddress { + const _CartSelectableAddress({required this.id, required this.address, this.selected, this.oneTimeUse}): super._(); + factory _CartSelectableAddress.fromJson(Map json) => _$CartSelectableAddressFromJson(json); + +@override final String id; +@override final CartDeliveryAddress address; +/// Whether this address is pre-selected for the buyer. Exactly one address +/// on a cart can be selected. +@override final bool? selected; +/// Whether this address is dropped after a successful checkout rather than +/// being associated with the buyer. +@override final bool? oneTimeUse; + +/// Create a copy of CartSelectableAddress +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CartSelectableAddressCopyWith<_CartSelectableAddress> get copyWith => __$CartSelectableAddressCopyWithImpl<_CartSelectableAddress>(this, _$identity); + +@override +Map toJson() { + return _$CartSelectableAddressToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartSelectableAddress&&(identical(other.id, id) || other.id == id)&&(identical(other.address, address) || other.address == address)&&(identical(other.selected, selected) || other.selected == selected)&&(identical(other.oneTimeUse, oneTimeUse) || other.oneTimeUse == oneTimeUse)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,address,selected,oneTimeUse); + +@override +String toString() { + return 'CartSelectableAddress(id: $id, address: $address, selected: $selected, oneTimeUse: $oneTimeUse)'; +} + + +} + +/// @nodoc +abstract mixin class _$CartSelectableAddressCopyWith<$Res> implements $CartSelectableAddressCopyWith<$Res> { + factory _$CartSelectableAddressCopyWith(_CartSelectableAddress value, $Res Function(_CartSelectableAddress) _then) = __$CartSelectableAddressCopyWithImpl; +@override @useResult +$Res call({ + String id, CartDeliveryAddress address, bool? selected, bool? oneTimeUse +}); + + +@override $CartDeliveryAddressCopyWith<$Res> get address; + +} +/// @nodoc +class __$CartSelectableAddressCopyWithImpl<$Res> + implements _$CartSelectableAddressCopyWith<$Res> { + __$CartSelectableAddressCopyWithImpl(this._self, this._then); + + final _CartSelectableAddress _self; + final $Res Function(_CartSelectableAddress) _then; + +/// Create a copy of CartSelectableAddress +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? address = null,Object? selected = freezed,Object? oneTimeUse = freezed,}) { + return _then(_CartSelectableAddress( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as CartDeliveryAddress,selected: freezed == selected ? _self.selected : selected // ignore: cast_nullable_to_non_nullable +as bool?,oneTimeUse: freezed == oneTimeUse ? _self.oneTimeUse : oneTimeUse // ignore: cast_nullable_to_non_nullable +as bool?, + )); +} + +/// Create a copy of CartSelectableAddress +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryAddressCopyWith<$Res> get address { + + return $CartDeliveryAddressCopyWith<$Res>(_self.address, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + +// dart format on diff --git a/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.g.dart b/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.g.dart new file mode 100644 index 00000000..3d817f34 --- /dev/null +++ b/lib/models/src/cart/cart_delivery/cart_selectable_address/cart_selectable_address.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cart_selectable_address.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CartSelectableAddress _$CartSelectableAddressFromJson( + Map json, +) => _CartSelectableAddress( + id: json['id'] as String, + address: CartDeliveryAddress.fromJson( + json['address'] as Map, + ), + selected: json['selected'] as bool?, + oneTimeUse: json['oneTimeUse'] as bool?, +); + +Map _$CartSelectableAddressToJson( + _CartSelectableAddress instance, +) => { + 'id': instance.id, + 'address': instance.address.toJson(), + 'selected': instance.selected, + 'oneTimeUse': instance.oneTimeUse, +}; diff --git a/lib/models/src/cart/cart_dicount_code/cart_discount_code.dart b/lib/models/src/cart/cart_dicount_code/cart_discount_code.dart index d84619f6..c8d46afe 100644 --- a/lib/models/src/cart/cart_dicount_code/cart_discount_code.dart +++ b/lib/models/src/cart/cart_dicount_code/cart_discount_code.dart @@ -13,6 +13,12 @@ abstract class CartDiscountCode with _$CartDiscountCode { const factory CartDiscountCode({ required bool? applicable, required String? code, + + /// Why the code is not [applicable], attached in code from the cart mutation's payload-level + /// `warnings` (`errorCode` = CartWarningCode, `errorMessage` = localized text). Absent from the + /// discountCodes JSON, so fromJson leaves them null; they're populated via copyWith after parsing. + String? errorCode, + String? errorMessage, }) = _CartDiscountCode; /// The CartDiscountCode from json diff --git a/lib/models/src/cart/cart_dicount_code/cart_discount_code.freezed.dart b/lib/models/src/cart/cart_dicount_code/cart_discount_code.freezed.dart index dd67e3fd..7ae38406 100644 --- a/lib/models/src/cart/cart_dicount_code/cart_discount_code.freezed.dart +++ b/lib/models/src/cart/cart_dicount_code/cart_discount_code.freezed.dart @@ -15,7 +15,10 @@ T _$identity(T value) => value; /// @nodoc mixin _$CartDiscountCode { - bool? get applicable; String? get code; + bool? get applicable; String? get code;/// Why the code is not [applicable], attached in code from the cart mutation's payload-level +/// `warnings` (`errorCode` = CartWarningCode, `errorMessage` = localized text). Absent from the +/// discountCodes JSON, so fromJson leaves them null; they're populated via copyWith after parsing. + String? get errorCode; String? get errorMessage; /// Create a copy of CartDiscountCode /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +31,16 @@ $CartDiscountCodeCopyWith get copyWith => _$CartDiscountCodeCo @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is CartDiscountCode&&(identical(other.applicable, applicable) || other.applicable == applicable)&&(identical(other.code, code) || other.code == code)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartDiscountCode&&(identical(other.applicable, applicable) || other.applicable == applicable)&&(identical(other.code, code) || other.code == code)&&(identical(other.errorCode, errorCode) || other.errorCode == errorCode)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,applicable,code); +int get hashCode => Object.hash(runtimeType,applicable,code,errorCode,errorMessage); @override String toString() { - return 'CartDiscountCode(applicable: $applicable, code: $code)'; + return 'CartDiscountCode(applicable: $applicable, code: $code, errorCode: $errorCode, errorMessage: $errorMessage)'; } @@ -48,7 +51,7 @@ abstract mixin class $CartDiscountCodeCopyWith<$Res> { factory $CartDiscountCodeCopyWith(CartDiscountCode value, $Res Function(CartDiscountCode) _then) = _$CartDiscountCodeCopyWithImpl; @useResult $Res call({ - bool? applicable, String? code + bool? applicable, String? code, String? errorCode, String? errorMessage }); @@ -65,10 +68,12 @@ class _$CartDiscountCodeCopyWithImpl<$Res> /// Create a copy of CartDiscountCode /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? applicable = freezed,Object? code = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? applicable = freezed,Object? code = freezed,Object? errorCode = freezed,Object? errorMessage = freezed,}) { return _then(_self.copyWith( applicable: freezed == applicable ? _self.applicable : applicable // ignore: cast_nullable_to_non_nullable as bool?,code: freezed == code ? _self.code : code // ignore: cast_nullable_to_non_nullable +as String?,errorCode: freezed == errorCode ? _self.errorCode : errorCode // ignore: cast_nullable_to_non_nullable +as String?,errorMessage: freezed == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String?, )); } @@ -154,10 +159,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool? applicable, String? code)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool? applicable, String? code, String? errorCode, String? errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _CartDiscountCode() when $default != null: -return $default(_that.applicable,_that.code);case _: +return $default(_that.applicable,_that.code,_that.errorCode,_that.errorMessage);case _: return orElse(); } @@ -175,10 +180,10 @@ return $default(_that.applicable,_that.code);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool? applicable, String? code) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool? applicable, String? code, String? errorCode, String? errorMessage) $default,) {final _that = this; switch (_that) { case _CartDiscountCode(): -return $default(_that.applicable,_that.code);case _: +return $default(_that.applicable,_that.code,_that.errorCode,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -195,10 +200,10 @@ return $default(_that.applicable,_that.code);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool? applicable, String? code)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool? applicable, String? code, String? errorCode, String? errorMessage)? $default,) {final _that = this; switch (_that) { case _CartDiscountCode() when $default != null: -return $default(_that.applicable,_that.code);case _: +return $default(_that.applicable,_that.code,_that.errorCode,_that.errorMessage);case _: return null; } @@ -210,11 +215,16 @@ return $default(_that.applicable,_that.code);case _: @JsonSerializable() class _CartDiscountCode extends CartDiscountCode { - const _CartDiscountCode({required this.applicable, required this.code}): super._(); + const _CartDiscountCode({required this.applicable, required this.code, this.errorCode, this.errorMessage}): super._(); factory _CartDiscountCode.fromJson(Map json) => _$CartDiscountCodeFromJson(json); @override final bool? applicable; @override final String? code; +/// Why the code is not [applicable], attached in code from the cart mutation's payload-level +/// `warnings` (`errorCode` = CartWarningCode, `errorMessage` = localized text). Absent from the +/// discountCodes JSON, so fromJson leaves them null; they're populated via copyWith after parsing. +@override final String? errorCode; +@override final String? errorMessage; /// Create a copy of CartDiscountCode /// with the given fields replaced by the non-null parameter values. @@ -229,16 +239,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartDiscountCode&&(identical(other.applicable, applicable) || other.applicable == applicable)&&(identical(other.code, code) || other.code == code)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartDiscountCode&&(identical(other.applicable, applicable) || other.applicable == applicable)&&(identical(other.code, code) || other.code == code)&&(identical(other.errorCode, errorCode) || other.errorCode == errorCode)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,applicable,code); +int get hashCode => Object.hash(runtimeType,applicable,code,errorCode,errorMessage); @override String toString() { - return 'CartDiscountCode(applicable: $applicable, code: $code)'; + return 'CartDiscountCode(applicable: $applicable, code: $code, errorCode: $errorCode, errorMessage: $errorMessage)'; } @@ -249,7 +259,7 @@ abstract mixin class _$CartDiscountCodeCopyWith<$Res> implements $CartDiscountCo factory _$CartDiscountCodeCopyWith(_CartDiscountCode value, $Res Function(_CartDiscountCode) _then) = __$CartDiscountCodeCopyWithImpl; @override @useResult $Res call({ - bool? applicable, String? code + bool? applicable, String? code, String? errorCode, String? errorMessage }); @@ -266,10 +276,12 @@ class __$CartDiscountCodeCopyWithImpl<$Res> /// Create a copy of CartDiscountCode /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? applicable = freezed,Object? code = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? applicable = freezed,Object? code = freezed,Object? errorCode = freezed,Object? errorMessage = freezed,}) { return _then(_CartDiscountCode( applicable: freezed == applicable ? _self.applicable : applicable // ignore: cast_nullable_to_non_nullable as bool?,code: freezed == code ? _self.code : code // ignore: cast_nullable_to_non_nullable +as String?,errorCode: freezed == errorCode ? _self.errorCode : errorCode // ignore: cast_nullable_to_non_nullable +as String?,errorMessage: freezed == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String?, )); } diff --git a/lib/models/src/cart/cart_dicount_code/cart_discount_code.g.dart b/lib/models/src/cart/cart_dicount_code/cart_discount_code.g.dart index 1b8b2a99..efd942db 100644 --- a/lib/models/src/cart/cart_dicount_code/cart_discount_code.g.dart +++ b/lib/models/src/cart/cart_dicount_code/cart_discount_code.g.dart @@ -10,7 +10,14 @@ _CartDiscountCode _$CartDiscountCodeFromJson(Map json) => _CartDiscountCode( applicable: json['applicable'] as bool?, code: json['code'] as String?, + errorCode: json['errorCode'] as String?, + errorMessage: json['errorMessage'] as String?, ); Map _$CartDiscountCodeToJson(_CartDiscountCode instance) => - {'applicable': instance.applicable, 'code': instance.code}; + { + 'applicable': instance.applicable, + 'code': instance.code, + 'errorCode': instance.errorCode, + 'errorMessage': instance.errorMessage, + }; diff --git a/lib/models/src/cart/cart_model.dart b/lib/models/src/cart/cart_model.dart index 581dbfb6..7425998a 100644 --- a/lib/models/src/cart/cart_model.dart +++ b/lib/models/src/cart/cart_model.dart @@ -3,6 +3,9 @@ export 'cart_buyer_identity/cart_buyer_identity.dart'; export 'cart_cost/cart_cost.dart'; export 'cart_dicount_code/cart_discount_code.dart'; export 'cart_discount_allocation/cart_discount_allocation.dart'; +export 'cart_delivery/cart_delivery.dart'; +export 'cart_delivery/cart_selectable_address/cart_selectable_address.dart'; +export 'cart_delivery/cart_delivery_address/cart_delivery_address.dart'; export 'cart_preference/cart_preference.dart'; export 'cart_preference/cart_delivery_coordinates_preference/cart_delivery_coordinates_preference.dart'; export 'cart_preference/cart_delivery_preference/cart_delivery_preference.dart'; diff --git a/lib/models/src/cart/inputs/cart_address_input/cart_address_input.dart b/lib/models/src/cart/inputs/cart_address_input/cart_address_input.dart new file mode 100644 index 00000000..a5d002d2 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_address_input/cart_address_input.dart @@ -0,0 +1,38 @@ +// ignore_for_file: invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../cart_delivery_address_input/cart_delivery_address_input.dart'; + +part 'cart_address_input.freezed.dart'; +part 'cart_address_input.g.dart'; + +@freezed + +/// Exactly one kind of delivery address: either an address stored on the cart +/// ([deliveryAddress]) or a copy of one of the customer's saved addresses +/// ([copyFromCustomerAddressId]). +/// +/// `CartAddressInput` is a "one of" input on the Storefront API — exactly one +/// field may be present. `includeIfNull: false` keeps the unused field out of +/// the serialized JSON so the server doesn't see it as a second argument +/// (otherwise: `'CartAddressInput' requires exactly one argument, but 2 were +/// provided`). +/// +/// Replaces the deprecated `DeliveryAddressInput`. +abstract class CartAddressInput with _$CartAddressInput { + const CartAddressInput._(); + + @Assert('copyFromCustomerAddressId == null || deliveryAddress == null', + 'Cannot contain both copyFromCustomerAddressId and deliveryAddress') + + /// The CartAddressInput constructor + const factory CartAddressInput({ + @JsonKey(includeIfNull: false) String? copyFromCustomerAddressId, + @JsonKey(includeIfNull: false) CartDeliveryAddressInput? deliveryAddress, + }) = _CartAddressInput; + + /// The CartAddressInput from json factory + factory CartAddressInput.fromJson(Map json) => + _$CartAddressInputFromJson(json); +} diff --git a/lib/models/src/cart/inputs/cart_address_input/cart_address_input.freezed.dart b/lib/models/src/cart/inputs/cart_address_input/cart_address_input.freezed.dart new file mode 100644 index 00000000..77687b8a --- /dev/null +++ b/lib/models/src/cart/inputs/cart_address_input/cart_address_input.freezed.dart @@ -0,0 +1,304 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cart_address_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$CartAddressInput { + +@JsonKey(includeIfNull: false) String? get copyFromCustomerAddressId;@JsonKey(includeIfNull: false) CartDeliveryAddressInput? get deliveryAddress; +/// Create a copy of CartAddressInput +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CartAddressInputCopyWith get copyWith => _$CartAddressInputCopyWithImpl(this as CartAddressInput, _$identity); + + /// Serializes this CartAddressInput to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartAddressInput&&(identical(other.copyFromCustomerAddressId, copyFromCustomerAddressId) || other.copyFromCustomerAddressId == copyFromCustomerAddressId)&&(identical(other.deliveryAddress, deliveryAddress) || other.deliveryAddress == deliveryAddress)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,copyFromCustomerAddressId,deliveryAddress); + +@override +String toString() { + return 'CartAddressInput(copyFromCustomerAddressId: $copyFromCustomerAddressId, deliveryAddress: $deliveryAddress)'; +} + + +} + +/// @nodoc +abstract mixin class $CartAddressInputCopyWith<$Res> { + factory $CartAddressInputCopyWith(CartAddressInput value, $Res Function(CartAddressInput) _then) = _$CartAddressInputCopyWithImpl; +@useResult +$Res call({ +@JsonKey(includeIfNull: false) String? copyFromCustomerAddressId,@JsonKey(includeIfNull: false) CartDeliveryAddressInput? deliveryAddress +}); + + +$CartDeliveryAddressInputCopyWith<$Res>? get deliveryAddress; + +} +/// @nodoc +class _$CartAddressInputCopyWithImpl<$Res> + implements $CartAddressInputCopyWith<$Res> { + _$CartAddressInputCopyWithImpl(this._self, this._then); + + final CartAddressInput _self; + final $Res Function(CartAddressInput) _then; + +/// Create a copy of CartAddressInput +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? copyFromCustomerAddressId = freezed,Object? deliveryAddress = freezed,}) { + return _then(_self.copyWith( +copyFromCustomerAddressId: freezed == copyFromCustomerAddressId ? _self.copyFromCustomerAddressId : copyFromCustomerAddressId // ignore: cast_nullable_to_non_nullable +as String?,deliveryAddress: freezed == deliveryAddress ? _self.deliveryAddress : deliveryAddress // ignore: cast_nullable_to_non_nullable +as CartDeliveryAddressInput?, + )); +} +/// Create a copy of CartAddressInput +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryAddressInputCopyWith<$Res>? get deliveryAddress { + if (_self.deliveryAddress == null) { + return null; + } + + return $CartDeliveryAddressInputCopyWith<$Res>(_self.deliveryAddress!, (value) { + return _then(_self.copyWith(deliveryAddress: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [CartAddressInput]. +extension CartAddressInputPatterns on CartAddressInput { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _CartAddressInput value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CartAddressInput() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _CartAddressInput value) $default,){ +final _that = this; +switch (_that) { +case _CartAddressInput(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CartAddressInput value)? $default,){ +final _that = this; +switch (_that) { +case _CartAddressInput() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function(@JsonKey(includeIfNull: false) String? copyFromCustomerAddressId, @JsonKey(includeIfNull: false) CartDeliveryAddressInput? deliveryAddress)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CartAddressInput() when $default != null: +return $default(_that.copyFromCustomerAddressId,_that.deliveryAddress);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function(@JsonKey(includeIfNull: false) String? copyFromCustomerAddressId, @JsonKey(includeIfNull: false) CartDeliveryAddressInput? deliveryAddress) $default,) {final _that = this; +switch (_that) { +case _CartAddressInput(): +return $default(_that.copyFromCustomerAddressId,_that.deliveryAddress);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@JsonKey(includeIfNull: false) String? copyFromCustomerAddressId, @JsonKey(includeIfNull: false) CartDeliveryAddressInput? deliveryAddress)? $default,) {final _that = this; +switch (_that) { +case _CartAddressInput() when $default != null: +return $default(_that.copyFromCustomerAddressId,_that.deliveryAddress);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _CartAddressInput extends CartAddressInput { + const _CartAddressInput({@JsonKey(includeIfNull: false) this.copyFromCustomerAddressId, @JsonKey(includeIfNull: false) this.deliveryAddress}): assert(copyFromCustomerAddressId == null || deliveryAddress == null, 'Cannot contain both copyFromCustomerAddressId and deliveryAddress'),super._(); + factory _CartAddressInput.fromJson(Map json) => _$CartAddressInputFromJson(json); + +@override@JsonKey(includeIfNull: false) final String? copyFromCustomerAddressId; +@override@JsonKey(includeIfNull: false) final CartDeliveryAddressInput? deliveryAddress; + +/// Create a copy of CartAddressInput +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CartAddressInputCopyWith<_CartAddressInput> get copyWith => __$CartAddressInputCopyWithImpl<_CartAddressInput>(this, _$identity); + +@override +Map toJson() { + return _$CartAddressInputToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartAddressInput&&(identical(other.copyFromCustomerAddressId, copyFromCustomerAddressId) || other.copyFromCustomerAddressId == copyFromCustomerAddressId)&&(identical(other.deliveryAddress, deliveryAddress) || other.deliveryAddress == deliveryAddress)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,copyFromCustomerAddressId,deliveryAddress); + +@override +String toString() { + return 'CartAddressInput(copyFromCustomerAddressId: $copyFromCustomerAddressId, deliveryAddress: $deliveryAddress)'; +} + + +} + +/// @nodoc +abstract mixin class _$CartAddressInputCopyWith<$Res> implements $CartAddressInputCopyWith<$Res> { + factory _$CartAddressInputCopyWith(_CartAddressInput value, $Res Function(_CartAddressInput) _then) = __$CartAddressInputCopyWithImpl; +@override @useResult +$Res call({ +@JsonKey(includeIfNull: false) String? copyFromCustomerAddressId,@JsonKey(includeIfNull: false) CartDeliveryAddressInput? deliveryAddress +}); + + +@override $CartDeliveryAddressInputCopyWith<$Res>? get deliveryAddress; + +} +/// @nodoc +class __$CartAddressInputCopyWithImpl<$Res> + implements _$CartAddressInputCopyWith<$Res> { + __$CartAddressInputCopyWithImpl(this._self, this._then); + + final _CartAddressInput _self; + final $Res Function(_CartAddressInput) _then; + +/// Create a copy of CartAddressInput +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? copyFromCustomerAddressId = freezed,Object? deliveryAddress = freezed,}) { + return _then(_CartAddressInput( +copyFromCustomerAddressId: freezed == copyFromCustomerAddressId ? _self.copyFromCustomerAddressId : copyFromCustomerAddressId // ignore: cast_nullable_to_non_nullable +as String?,deliveryAddress: freezed == deliveryAddress ? _self.deliveryAddress : deliveryAddress // ignore: cast_nullable_to_non_nullable +as CartDeliveryAddressInput?, + )); +} + +/// Create a copy of CartAddressInput +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryAddressInputCopyWith<$Res>? get deliveryAddress { + if (_self.deliveryAddress == null) { + return null; + } + + return $CartDeliveryAddressInputCopyWith<$Res>(_self.deliveryAddress!, (value) { + return _then(_self.copyWith(deliveryAddress: value)); + }); +} +} + +// dart format on diff --git a/lib/models/src/cart/inputs/cart_address_input/cart_address_input.g.dart b/lib/models/src/cart/inputs/cart_address_input/cart_address_input.g.dart new file mode 100644 index 00000000..c668d297 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_address_input/cart_address_input.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cart_address_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CartAddressInput _$CartAddressInputFromJson(Map json) => + _CartAddressInput( + copyFromCustomerAddressId: json['copyFromCustomerAddressId'] as String?, + deliveryAddress: json['deliveryAddress'] == null + ? null + : CartDeliveryAddressInput.fromJson( + json['deliveryAddress'] as Map, + ), + ); + +Map _$CartAddressInputToJson(_CartAddressInput instance) => + { + 'copyFromCustomerAddressId': ?instance.copyFromCustomerAddressId, + 'deliveryAddress': ?instance.deliveryAddress?.toJson(), + }; diff --git a/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.dart b/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.dart index 95f2c3c7..ccef64f0 100644 --- a/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.dart +++ b/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.dart @@ -1,7 +1,5 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import '../delivery_address_input/delivery_address_input.dart'; - part 'cart_buyer_identity_input.freezed.dart'; part 'cart_buyer_identity_input.g.dart'; @@ -17,7 +15,6 @@ abstract class CartBuyerIdentityInput with _$CartBuyerIdentityInput { String? phone, String? countryCode, String? customerAccessToken, - @Default([]) List deliveryAddressPreferences, }) = _CartBuyerIdentityInput; /// the cart buyer identity input from json factory diff --git a/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.freezed.dart b/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.freezed.dart index 75fe6ad6..51defd3f 100644 --- a/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.freezed.dart +++ b/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$CartBuyerIdentityInput { - String get email; String? get phone; String? get countryCode; String? get customerAccessToken; List get deliveryAddressPreferences; + String get email; String? get phone; String? get countryCode; String? get customerAccessToken; /// Create a copy of CartBuyerIdentityInput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $CartBuyerIdentityInputCopyWith get copyWith => _$CartBu @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is CartBuyerIdentityInput&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.customerAccessToken, customerAccessToken) || other.customerAccessToken == customerAccessToken)&&const DeepCollectionEquality().equals(other.deliveryAddressPreferences, deliveryAddressPreferences)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartBuyerIdentityInput&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.customerAccessToken, customerAccessToken) || other.customerAccessToken == customerAccessToken)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,email,phone,countryCode,customerAccessToken,const DeepCollectionEquality().hash(deliveryAddressPreferences)); +int get hashCode => Object.hash(runtimeType,email,phone,countryCode,customerAccessToken); @override String toString() { - return 'CartBuyerIdentityInput(email: $email, phone: $phone, countryCode: $countryCode, customerAccessToken: $customerAccessToken, deliveryAddressPreferences: $deliveryAddressPreferences)'; + return 'CartBuyerIdentityInput(email: $email, phone: $phone, countryCode: $countryCode, customerAccessToken: $customerAccessToken)'; } @@ -48,7 +48,7 @@ abstract mixin class $CartBuyerIdentityInputCopyWith<$Res> { factory $CartBuyerIdentityInputCopyWith(CartBuyerIdentityInput value, $Res Function(CartBuyerIdentityInput) _then) = _$CartBuyerIdentityInputCopyWithImpl; @useResult $Res call({ - String email, String? phone, String? countryCode, String? customerAccessToken, List deliveryAddressPreferences + String email, String? phone, String? countryCode, String? customerAccessToken }); @@ -65,14 +65,13 @@ class _$CartBuyerIdentityInputCopyWithImpl<$Res> /// Create a copy of CartBuyerIdentityInput /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? email = null,Object? phone = freezed,Object? countryCode = freezed,Object? customerAccessToken = freezed,Object? deliveryAddressPreferences = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? email = null,Object? phone = freezed,Object? countryCode = freezed,Object? customerAccessToken = freezed,}) { return _then(_self.copyWith( email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable as String?,customerAccessToken: freezed == customerAccessToken ? _self.customerAccessToken : customerAccessToken // ignore: cast_nullable_to_non_nullable -as String?,deliveryAddressPreferences: null == deliveryAddressPreferences ? _self.deliveryAddressPreferences : deliveryAddressPreferences // ignore: cast_nullable_to_non_nullable -as List, +as String?, )); } @@ -157,10 +156,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String email, String? phone, String? countryCode, String? customerAccessToken, List deliveryAddressPreferences)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String email, String? phone, String? countryCode, String? customerAccessToken)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _CartBuyerIdentityInput() when $default != null: -return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessToken,_that.deliveryAddressPreferences);case _: +return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessToken);case _: return orElse(); } @@ -178,10 +177,10 @@ return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessTo /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String email, String? phone, String? countryCode, String? customerAccessToken, List deliveryAddressPreferences) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String email, String? phone, String? countryCode, String? customerAccessToken) $default,) {final _that = this; switch (_that) { case _CartBuyerIdentityInput(): -return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessToken,_that.deliveryAddressPreferences);case _: +return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessToken);case _: throw StateError('Unexpected subclass'); } @@ -198,10 +197,10 @@ return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessTo /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String email, String? phone, String? countryCode, String? customerAccessToken, List deliveryAddressPreferences)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String email, String? phone, String? countryCode, String? customerAccessToken)? $default,) {final _that = this; switch (_that) { case _CartBuyerIdentityInput() when $default != null: -return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessToken,_that.deliveryAddressPreferences);case _: +return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessToken);case _: return null; } @@ -213,20 +212,13 @@ return $default(_that.email,_that.phone,_that.countryCode,_that.customerAccessTo @JsonSerializable() class _CartBuyerIdentityInput extends CartBuyerIdentityInput { - const _CartBuyerIdentityInput({required this.email, this.phone, this.countryCode, this.customerAccessToken, final List deliveryAddressPreferences = const []}): _deliveryAddressPreferences = deliveryAddressPreferences,super._(); + const _CartBuyerIdentityInput({required this.email, this.phone, this.countryCode, this.customerAccessToken}): super._(); factory _CartBuyerIdentityInput.fromJson(Map json) => _$CartBuyerIdentityInputFromJson(json); @override final String email; @override final String? phone; @override final String? countryCode; @override final String? customerAccessToken; - final List _deliveryAddressPreferences; -@override@JsonKey() List get deliveryAddressPreferences { - if (_deliveryAddressPreferences is EqualUnmodifiableListView) return _deliveryAddressPreferences; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_deliveryAddressPreferences); -} - /// Create a copy of CartBuyerIdentityInput /// with the given fields replaced by the non-null parameter values. @@ -241,16 +233,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartBuyerIdentityInput&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.customerAccessToken, customerAccessToken) || other.customerAccessToken == customerAccessToken)&&const DeepCollectionEquality().equals(other._deliveryAddressPreferences, _deliveryAddressPreferences)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartBuyerIdentityInput&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.customerAccessToken, customerAccessToken) || other.customerAccessToken == customerAccessToken)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,email,phone,countryCode,customerAccessToken,const DeepCollectionEquality().hash(_deliveryAddressPreferences)); +int get hashCode => Object.hash(runtimeType,email,phone,countryCode,customerAccessToken); @override String toString() { - return 'CartBuyerIdentityInput(email: $email, phone: $phone, countryCode: $countryCode, customerAccessToken: $customerAccessToken, deliveryAddressPreferences: $deliveryAddressPreferences)'; + return 'CartBuyerIdentityInput(email: $email, phone: $phone, countryCode: $countryCode, customerAccessToken: $customerAccessToken)'; } @@ -261,7 +253,7 @@ abstract mixin class _$CartBuyerIdentityInputCopyWith<$Res> implements $CartBuye factory _$CartBuyerIdentityInputCopyWith(_CartBuyerIdentityInput value, $Res Function(_CartBuyerIdentityInput) _then) = __$CartBuyerIdentityInputCopyWithImpl; @override @useResult $Res call({ - String email, String? phone, String? countryCode, String? customerAccessToken, List deliveryAddressPreferences + String email, String? phone, String? countryCode, String? customerAccessToken }); @@ -278,14 +270,13 @@ class __$CartBuyerIdentityInputCopyWithImpl<$Res> /// Create a copy of CartBuyerIdentityInput /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? email = null,Object? phone = freezed,Object? countryCode = freezed,Object? customerAccessToken = freezed,Object? deliveryAddressPreferences = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? email = null,Object? phone = freezed,Object? countryCode = freezed,Object? customerAccessToken = freezed,}) { return _then(_CartBuyerIdentityInput( email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable as String?,customerAccessToken: freezed == customerAccessToken ? _self.customerAccessToken : customerAccessToken // ignore: cast_nullable_to_non_nullable -as String?,deliveryAddressPreferences: null == deliveryAddressPreferences ? _self._deliveryAddressPreferences : deliveryAddressPreferences // ignore: cast_nullable_to_non_nullable -as List, +as String?, )); } diff --git a/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.g.dart b/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.g.dart index 429ab32b..8a8ab011 100644 --- a/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.g.dart +++ b/lib/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.g.dart @@ -13,15 +13,6 @@ _CartBuyerIdentityInput _$CartBuyerIdentityInputFromJson( phone: json['phone'] as String?, countryCode: json['countryCode'] as String?, customerAccessToken: json['customerAccessToken'] as String?, - deliveryAddressPreferences: - (json['deliveryAddressPreferences'] as List?) - ?.map( - (e) => e == null - ? null - : DeliveryAddressInput.fromJson(e as Map), - ) - .toList() ?? - const [], ); Map _$CartBuyerIdentityInputToJson( @@ -31,7 +22,4 @@ Map _$CartBuyerIdentityInputToJson( 'phone': instance.phone, 'countryCode': instance.countryCode, 'customerAccessToken': instance.customerAccessToken, - 'deliveryAddressPreferences': instance.deliveryAddressPreferences - .map((e) => e?.toJson()) - .toList(), }; diff --git a/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.dart b/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.dart new file mode 100644 index 00000000..5ac6133f --- /dev/null +++ b/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.dart @@ -0,0 +1,33 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'cart_delivery_address_input.freezed.dart'; +part 'cart_delivery_address_input.g.dart'; + +@freezed + +/// A delivery address to store on a cart. +/// +/// Replaces `MailingAddressInput` for cart delivery. Note that Shopify expects +/// [countryCode] (e.g. `AU`) and [provinceCode] (e.g. `NSW`) here rather than +/// the full country/province names. +abstract class CartDeliveryAddressInput with _$CartDeliveryAddressInput { + const CartDeliveryAddressInput._(); + + /// The CartDeliveryAddressInput constructor + const factory CartDeliveryAddressInput({ + String? address1, + String? address2, + String? city, + String? company, + String? countryCode, + String? firstName, + String? lastName, + String? phone, + String? provinceCode, + String? zip, + }) = _CartDeliveryAddressInput; + + /// The CartDeliveryAddressInput from json factory + factory CartDeliveryAddressInput.fromJson(Map json) => + _$CartDeliveryAddressInputFromJson(json); +} diff --git a/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.freezed.dart b/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.freezed.dart new file mode 100644 index 00000000..29a381c8 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.freezed.dart @@ -0,0 +1,304 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cart_delivery_address_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$CartDeliveryAddressInput { + + String? get address1; String? get address2; String? get city; String? get company; String? get countryCode; String? get firstName; String? get lastName; String? get phone; String? get provinceCode; String? get zip; +/// Create a copy of CartDeliveryAddressInput +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CartDeliveryAddressInputCopyWith get copyWith => _$CartDeliveryAddressInputCopyWithImpl(this as CartDeliveryAddressInput, _$identity); + + /// Serializes this CartDeliveryAddressInput to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartDeliveryAddressInput&&(identical(other.address1, address1) || other.address1 == address1)&&(identical(other.address2, address2) || other.address2 == address2)&&(identical(other.city, city) || other.city == city)&&(identical(other.company, company) || other.company == company)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.provinceCode, provinceCode) || other.provinceCode == provinceCode)&&(identical(other.zip, zip) || other.zip == zip)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,address1,address2,city,company,countryCode,firstName,lastName,phone,provinceCode,zip); + +@override +String toString() { + return 'CartDeliveryAddressInput(address1: $address1, address2: $address2, city: $city, company: $company, countryCode: $countryCode, firstName: $firstName, lastName: $lastName, phone: $phone, provinceCode: $provinceCode, zip: $zip)'; +} + + +} + +/// @nodoc +abstract mixin class $CartDeliveryAddressInputCopyWith<$Res> { + factory $CartDeliveryAddressInputCopyWith(CartDeliveryAddressInput value, $Res Function(CartDeliveryAddressInput) _then) = _$CartDeliveryAddressInputCopyWithImpl; +@useResult +$Res call({ + String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? phone, String? provinceCode, String? zip +}); + + + + +} +/// @nodoc +class _$CartDeliveryAddressInputCopyWithImpl<$Res> + implements $CartDeliveryAddressInputCopyWith<$Res> { + _$CartDeliveryAddressInputCopyWithImpl(this._self, this._then); + + final CartDeliveryAddressInput _self; + final $Res Function(CartDeliveryAddressInput) _then; + +/// Create a copy of CartDeliveryAddressInput +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? address1 = freezed,Object? address2 = freezed,Object? city = freezed,Object? company = freezed,Object? countryCode = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,Object? provinceCode = freezed,Object? zip = freezed,}) { + return _then(_self.copyWith( +address1: freezed == address1 ? _self.address1 : address1 // ignore: cast_nullable_to_non_nullable +as String?,address2: freezed == address2 ? _self.address2 : address2 // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,company: freezed == company ? _self.company : company // ignore: cast_nullable_to_non_nullable +as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?,provinceCode: freezed == provinceCode ? _self.provinceCode : provinceCode // ignore: cast_nullable_to_non_nullable +as String?,zip: freezed == zip ? _self.zip : zip // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [CartDeliveryAddressInput]. +extension CartDeliveryAddressInputPatterns on CartDeliveryAddressInput { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _CartDeliveryAddressInput value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CartDeliveryAddressInput() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _CartDeliveryAddressInput value) $default,){ +final _that = this; +switch (_that) { +case _CartDeliveryAddressInput(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CartDeliveryAddressInput value)? $default,){ +final _that = this; +switch (_that) { +case _CartDeliveryAddressInput() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? phone, String? provinceCode, String? zip)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CartDeliveryAddressInput() when $default != null: +return $default(_that.address1,_that.address2,_that.city,_that.company,_that.countryCode,_that.firstName,_that.lastName,_that.phone,_that.provinceCode,_that.zip);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? phone, String? provinceCode, String? zip) $default,) {final _that = this; +switch (_that) { +case _CartDeliveryAddressInput(): +return $default(_that.address1,_that.address2,_that.city,_that.company,_that.countryCode,_that.firstName,_that.lastName,_that.phone,_that.provinceCode,_that.zip);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? phone, String? provinceCode, String? zip)? $default,) {final _that = this; +switch (_that) { +case _CartDeliveryAddressInput() when $default != null: +return $default(_that.address1,_that.address2,_that.city,_that.company,_that.countryCode,_that.firstName,_that.lastName,_that.phone,_that.provinceCode,_that.zip);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _CartDeliveryAddressInput extends CartDeliveryAddressInput { + const _CartDeliveryAddressInput({this.address1, this.address2, this.city, this.company, this.countryCode, this.firstName, this.lastName, this.phone, this.provinceCode, this.zip}): super._(); + factory _CartDeliveryAddressInput.fromJson(Map json) => _$CartDeliveryAddressInputFromJson(json); + +@override final String? address1; +@override final String? address2; +@override final String? city; +@override final String? company; +@override final String? countryCode; +@override final String? firstName; +@override final String? lastName; +@override final String? phone; +@override final String? provinceCode; +@override final String? zip; + +/// Create a copy of CartDeliveryAddressInput +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CartDeliveryAddressInputCopyWith<_CartDeliveryAddressInput> get copyWith => __$CartDeliveryAddressInputCopyWithImpl<_CartDeliveryAddressInput>(this, _$identity); + +@override +Map toJson() { + return _$CartDeliveryAddressInputToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartDeliveryAddressInput&&(identical(other.address1, address1) || other.address1 == address1)&&(identical(other.address2, address2) || other.address2 == address2)&&(identical(other.city, city) || other.city == city)&&(identical(other.company, company) || other.company == company)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.provinceCode, provinceCode) || other.provinceCode == provinceCode)&&(identical(other.zip, zip) || other.zip == zip)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,address1,address2,city,company,countryCode,firstName,lastName,phone,provinceCode,zip); + +@override +String toString() { + return 'CartDeliveryAddressInput(address1: $address1, address2: $address2, city: $city, company: $company, countryCode: $countryCode, firstName: $firstName, lastName: $lastName, phone: $phone, provinceCode: $provinceCode, zip: $zip)'; +} + + +} + +/// @nodoc +abstract mixin class _$CartDeliveryAddressInputCopyWith<$Res> implements $CartDeliveryAddressInputCopyWith<$Res> { + factory _$CartDeliveryAddressInputCopyWith(_CartDeliveryAddressInput value, $Res Function(_CartDeliveryAddressInput) _then) = __$CartDeliveryAddressInputCopyWithImpl; +@override @useResult +$Res call({ + String? address1, String? address2, String? city, String? company, String? countryCode, String? firstName, String? lastName, String? phone, String? provinceCode, String? zip +}); + + + + +} +/// @nodoc +class __$CartDeliveryAddressInputCopyWithImpl<$Res> + implements _$CartDeliveryAddressInputCopyWith<$Res> { + __$CartDeliveryAddressInputCopyWithImpl(this._self, this._then); + + final _CartDeliveryAddressInput _self; + final $Res Function(_CartDeliveryAddressInput) _then; + +/// Create a copy of CartDeliveryAddressInput +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? address1 = freezed,Object? address2 = freezed,Object? city = freezed,Object? company = freezed,Object? countryCode = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,Object? provinceCode = freezed,Object? zip = freezed,}) { + return _then(_CartDeliveryAddressInput( +address1: freezed == address1 ? _self.address1 : address1 // ignore: cast_nullable_to_non_nullable +as String?,address2: freezed == address2 ? _self.address2 : address2 // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,company: freezed == company ? _self.company : company // ignore: cast_nullable_to_non_nullable +as String?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?,provinceCode: freezed == provinceCode ? _self.provinceCode : provinceCode // ignore: cast_nullable_to_non_nullable +as String?,zip: freezed == zip ? _self.zip : zip // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.g.dart b/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.g.dart new file mode 100644 index 00000000..7979a4ee --- /dev/null +++ b/lib/models/src/cart/inputs/cart_delivery_address_input/cart_delivery_address_input.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cart_delivery_address_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CartDeliveryAddressInput _$CartDeliveryAddressInputFromJson( + Map json, +) => _CartDeliveryAddressInput( + address1: json['address1'] as String?, + address2: json['address2'] as String?, + city: json['city'] as String?, + company: json['company'] as String?, + countryCode: json['countryCode'] as String?, + firstName: json['firstName'] as String?, + lastName: json['lastName'] as String?, + phone: json['phone'] as String?, + provinceCode: json['provinceCode'] as String?, + zip: json['zip'] as String?, +); + +Map _$CartDeliveryAddressInputToJson( + _CartDeliveryAddressInput instance, +) => { + 'address1': instance.address1, + 'address2': instance.address2, + 'city': instance.city, + 'company': instance.company, + 'countryCode': instance.countryCode, + 'firstName': instance.firstName, + 'lastName': instance.lastName, + 'phone': instance.phone, + 'provinceCode': instance.provinceCode, + 'zip': instance.zip, +}; diff --git a/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.dart b/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.dart new file mode 100644 index 00000000..d5e0c7c4 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.dart @@ -0,0 +1,24 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../cart_selectable_address_input/cart_selectable_address_input.dart'; + +part 'cart_delivery_input.freezed.dart'; +part 'cart_delivery_input.g.dart'; + +@freezed + +/// The delivery-related fields of a cart. +/// +/// Replaces the deprecated `CartBuyerIdentityInput.deliveryAddressPreferences`. +abstract class CartDeliveryInput with _$CartDeliveryInput { + const CartDeliveryInput._(); + + /// The CartDeliveryInput constructor + const factory CartDeliveryInput({ + @Default([]) List addresses, + }) = _CartDeliveryInput; + + /// The CartDeliveryInput from json factory + factory CartDeliveryInput.fromJson(Map json) => + _$CartDeliveryInputFromJson(json); +} diff --git a/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.freezed.dart b/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.freezed.dart new file mode 100644 index 00000000..bf0a17e7 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.freezed.dart @@ -0,0 +1,283 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cart_delivery_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$CartDeliveryInput { + + List get addresses; +/// Create a copy of CartDeliveryInput +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CartDeliveryInputCopyWith get copyWith => _$CartDeliveryInputCopyWithImpl(this as CartDeliveryInput, _$identity); + + /// Serializes this CartDeliveryInput to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartDeliveryInput&&const DeepCollectionEquality().equals(other.addresses, addresses)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(addresses)); + +@override +String toString() { + return 'CartDeliveryInput(addresses: $addresses)'; +} + + +} + +/// @nodoc +abstract mixin class $CartDeliveryInputCopyWith<$Res> { + factory $CartDeliveryInputCopyWith(CartDeliveryInput value, $Res Function(CartDeliveryInput) _then) = _$CartDeliveryInputCopyWithImpl; +@useResult +$Res call({ + List addresses +}); + + + + +} +/// @nodoc +class _$CartDeliveryInputCopyWithImpl<$Res> + implements $CartDeliveryInputCopyWith<$Res> { + _$CartDeliveryInputCopyWithImpl(this._self, this._then); + + final CartDeliveryInput _self; + final $Res Function(CartDeliveryInput) _then; + +/// Create a copy of CartDeliveryInput +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? addresses = null,}) { + return _then(_self.copyWith( +addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [CartDeliveryInput]. +extension CartDeliveryInputPatterns on CartDeliveryInput { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _CartDeliveryInput value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CartDeliveryInput() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _CartDeliveryInput value) $default,){ +final _that = this; +switch (_that) { +case _CartDeliveryInput(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CartDeliveryInput value)? $default,){ +final _that = this; +switch (_that) { +case _CartDeliveryInput() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( List addresses)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CartDeliveryInput() when $default != null: +return $default(_that.addresses);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( List addresses) $default,) {final _that = this; +switch (_that) { +case _CartDeliveryInput(): +return $default(_that.addresses);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List addresses)? $default,) {final _that = this; +switch (_that) { +case _CartDeliveryInput() when $default != null: +return $default(_that.addresses);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _CartDeliveryInput extends CartDeliveryInput { + const _CartDeliveryInput({final List addresses = const []}): _addresses = addresses,super._(); + factory _CartDeliveryInput.fromJson(Map json) => _$CartDeliveryInputFromJson(json); + + final List _addresses; +@override@JsonKey() List get addresses { + if (_addresses is EqualUnmodifiableListView) return _addresses; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_addresses); +} + + +/// Create a copy of CartDeliveryInput +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CartDeliveryInputCopyWith<_CartDeliveryInput> get copyWith => __$CartDeliveryInputCopyWithImpl<_CartDeliveryInput>(this, _$identity); + +@override +Map toJson() { + return _$CartDeliveryInputToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartDeliveryInput&&const DeepCollectionEquality().equals(other._addresses, _addresses)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_addresses)); + +@override +String toString() { + return 'CartDeliveryInput(addresses: $addresses)'; +} + + +} + +/// @nodoc +abstract mixin class _$CartDeliveryInputCopyWith<$Res> implements $CartDeliveryInputCopyWith<$Res> { + factory _$CartDeliveryInputCopyWith(_CartDeliveryInput value, $Res Function(_CartDeliveryInput) _then) = __$CartDeliveryInputCopyWithImpl; +@override @useResult +$Res call({ + List addresses +}); + + + + +} +/// @nodoc +class __$CartDeliveryInputCopyWithImpl<$Res> + implements _$CartDeliveryInputCopyWith<$Res> { + __$CartDeliveryInputCopyWithImpl(this._self, this._then); + + final _CartDeliveryInput _self; + final $Res Function(_CartDeliveryInput) _then; + +/// Create a copy of CartDeliveryInput +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? addresses = null,}) { + return _then(_CartDeliveryInput( +addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +// dart format on diff --git a/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.g.dart b/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.g.dart new file mode 100644 index 00000000..15554af7 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_delivery_input/cart_delivery_input.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cart_delivery_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CartDeliveryInput _$CartDeliveryInputFromJson(Map json) => + _CartDeliveryInput( + addresses: + (json['addresses'] as List?) + ?.map( + (e) => CartSelectableAddressInput.fromJson( + e as Map, + ), + ) + .toList() ?? + const [], + ); + +Map _$CartDeliveryInputToJson(_CartDeliveryInput instance) => + { + 'addresses': instance.addresses.map((e) => e.toJson()).toList(), + }; diff --git a/lib/models/src/cart/inputs/cart_input/cart_input.dart b/lib/models/src/cart/inputs/cart_input/cart_input.dart index 2c5a1ed8..c7fa9e12 100644 --- a/lib/models/src/cart/inputs/cart_input/cart_input.dart +++ b/lib/models/src/cart/inputs/cart_input/cart_input.dart @@ -1,6 +1,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:shopify_flutter/models/src/cart/inputs/cart_buyer_identity_input/cart_buyer_identity_input.dart'; +import '../cart_delivery_input/cart_delivery_input.dart'; import '../cart_line_input/cart_line_input.dart'; import '../attribute_input/attribute_input.dart'; @@ -20,6 +21,10 @@ abstract class CartInput with _$CartInput { @Default('') String note, @Default([]) List attributes, CartBuyerIdentityInput? buyerIdentity, + + /// Delivery addresses for the cart. Replaces the deprecated + /// `buyerIdentity.deliveryAddressPreferences`. + CartDeliveryInput? delivery, }) = _CartInput; /// The cart input from json factory diff --git a/lib/models/src/cart/inputs/cart_input/cart_input.freezed.dart b/lib/models/src/cart/inputs/cart_input/cart_input.freezed.dart index ec29bd02..48ac3def 100644 --- a/lib/models/src/cart/inputs/cart_input/cart_input.freezed.dart +++ b/lib/models/src/cart/inputs/cart_input/cart_input.freezed.dart @@ -15,7 +15,9 @@ T _$identity(T value) => value; /// @nodoc mixin _$CartInput { - List get discountCodes; List get lines; String get note; List get attributes; CartBuyerIdentityInput? get buyerIdentity; + List get discountCodes; List get lines; String get note; List get attributes; CartBuyerIdentityInput? get buyerIdentity;/// Delivery addresses for the cart. Replaces the deprecated +/// `buyerIdentity.deliveryAddressPreferences`. + CartDeliveryInput? get delivery; /// Create a copy of CartInput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +30,16 @@ $CartInputCopyWith get copyWith => _$CartInputCopyWithImpl @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is CartInput&&const DeepCollectionEquality().equals(other.discountCodes, discountCodes)&&const DeepCollectionEquality().equals(other.lines, lines)&&(identical(other.note, note) || other.note == note)&&const DeepCollectionEquality().equals(other.attributes, attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartInput&&const DeepCollectionEquality().equals(other.discountCodes, discountCodes)&&const DeepCollectionEquality().equals(other.lines, lines)&&(identical(other.note, note) || other.note == note)&&const DeepCollectionEquality().equals(other.attributes, attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)&&(identical(other.delivery, delivery) || other.delivery == delivery)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(discountCodes),const DeepCollectionEquality().hash(lines),note,const DeepCollectionEquality().hash(attributes),buyerIdentity); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(discountCodes),const DeepCollectionEquality().hash(lines),note,const DeepCollectionEquality().hash(attributes),buyerIdentity,delivery); @override String toString() { - return 'CartInput(discountCodes: $discountCodes, lines: $lines, note: $note, attributes: $attributes, buyerIdentity: $buyerIdentity)'; + return 'CartInput(discountCodes: $discountCodes, lines: $lines, note: $note, attributes: $attributes, buyerIdentity: $buyerIdentity, delivery: $delivery)'; } @@ -48,11 +50,11 @@ abstract mixin class $CartInputCopyWith<$Res> { factory $CartInputCopyWith(CartInput value, $Res Function(CartInput) _then) = _$CartInputCopyWithImpl; @useResult $Res call({ - List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity + List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity, CartDeliveryInput? delivery }); -$CartBuyerIdentityInputCopyWith<$Res>? get buyerIdentity; +$CartBuyerIdentityInputCopyWith<$Res>? get buyerIdentity;$CartDeliveryInputCopyWith<$Res>? get delivery; } /// @nodoc @@ -65,14 +67,15 @@ class _$CartInputCopyWithImpl<$Res> /// Create a copy of CartInput /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? discountCodes = null,Object? lines = null,Object? note = null,Object? attributes = null,Object? buyerIdentity = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? discountCodes = null,Object? lines = null,Object? note = null,Object? attributes = null,Object? buyerIdentity = freezed,Object? delivery = freezed,}) { return _then(_self.copyWith( discountCodes: null == discountCodes ? _self.discountCodes : discountCodes // ignore: cast_nullable_to_non_nullable as List,lines: null == lines ? _self.lines : lines // ignore: cast_nullable_to_non_nullable as List,note: null == note ? _self.note : note // ignore: cast_nullable_to_non_nullable as String,attributes: null == attributes ? _self.attributes : attributes // ignore: cast_nullable_to_non_nullable as List,buyerIdentity: freezed == buyerIdentity ? _self.buyerIdentity : buyerIdentity // ignore: cast_nullable_to_non_nullable -as CartBuyerIdentityInput?, +as CartBuyerIdentityInput?,delivery: freezed == delivery ? _self.delivery : delivery // ignore: cast_nullable_to_non_nullable +as CartDeliveryInput?, )); } /// Create a copy of CartInput @@ -87,6 +90,18 @@ $CartBuyerIdentityInputCopyWith<$Res>? get buyerIdentity { return $CartBuyerIdentityInputCopyWith<$Res>(_self.buyerIdentity!, (value) { return _then(_self.copyWith(buyerIdentity: value)); }); +}/// Create a copy of CartInput +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryInputCopyWith<$Res>? get delivery { + if (_self.delivery == null) { + return null; + } + + return $CartDeliveryInputCopyWith<$Res>(_self.delivery!, (value) { + return _then(_self.copyWith(delivery: value)); + }); } } @@ -169,10 +184,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity, CartDeliveryInput? delivery)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _CartInput() when $default != null: -return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_that.buyerIdentity);case _: +return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_that.buyerIdentity,_that.delivery);case _: return orElse(); } @@ -190,10 +205,10 @@ return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_tha /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity, CartDeliveryInput? delivery) $default,) {final _that = this; switch (_that) { case _CartInput(): -return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_that.buyerIdentity);case _: +return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_that.buyerIdentity,_that.delivery);case _: throw StateError('Unexpected subclass'); } @@ -210,10 +225,10 @@ return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_tha /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity, CartDeliveryInput? delivery)? $default,) {final _that = this; switch (_that) { case _CartInput() when $default != null: -return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_that.buyerIdentity);case _: +return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_that.buyerIdentity,_that.delivery);case _: return null; } @@ -225,7 +240,7 @@ return $default(_that.discountCodes,_that.lines,_that.note,_that.attributes,_tha @JsonSerializable() class _CartInput extends CartInput { - const _CartInput({final List discountCodes = const [], final List lines = const [], this.note = '', final List attributes = const [], this.buyerIdentity}): _discountCodes = discountCodes,_lines = lines,_attributes = attributes,super._(); + const _CartInput({final List discountCodes = const [], final List lines = const [], this.note = '', final List attributes = const [], this.buyerIdentity, this.delivery}): _discountCodes = discountCodes,_lines = lines,_attributes = attributes,super._(); factory _CartInput.fromJson(Map json) => _$CartInputFromJson(json); final List _discountCodes; @@ -251,6 +266,9 @@ class _CartInput extends CartInput { } @override final CartBuyerIdentityInput? buyerIdentity; +/// Delivery addresses for the cart. Replaces the deprecated +/// `buyerIdentity.deliveryAddressPreferences`. +@override final CartDeliveryInput? delivery; /// Create a copy of CartInput /// with the given fields replaced by the non-null parameter values. @@ -265,16 +283,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartInput&&const DeepCollectionEquality().equals(other._discountCodes, _discountCodes)&&const DeepCollectionEquality().equals(other._lines, _lines)&&(identical(other.note, note) || other.note == note)&&const DeepCollectionEquality().equals(other._attributes, _attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartInput&&const DeepCollectionEquality().equals(other._discountCodes, _discountCodes)&&const DeepCollectionEquality().equals(other._lines, _lines)&&(identical(other.note, note) || other.note == note)&&const DeepCollectionEquality().equals(other._attributes, _attributes)&&(identical(other.buyerIdentity, buyerIdentity) || other.buyerIdentity == buyerIdentity)&&(identical(other.delivery, delivery) || other.delivery == delivery)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_discountCodes),const DeepCollectionEquality().hash(_lines),note,const DeepCollectionEquality().hash(_attributes),buyerIdentity); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_discountCodes),const DeepCollectionEquality().hash(_lines),note,const DeepCollectionEquality().hash(_attributes),buyerIdentity,delivery); @override String toString() { - return 'CartInput(discountCodes: $discountCodes, lines: $lines, note: $note, attributes: $attributes, buyerIdentity: $buyerIdentity)'; + return 'CartInput(discountCodes: $discountCodes, lines: $lines, note: $note, attributes: $attributes, buyerIdentity: $buyerIdentity, delivery: $delivery)'; } @@ -285,11 +303,11 @@ abstract mixin class _$CartInputCopyWith<$Res> implements $CartInputCopyWith<$Re factory _$CartInputCopyWith(_CartInput value, $Res Function(_CartInput) _then) = __$CartInputCopyWithImpl; @override @useResult $Res call({ - List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity + List discountCodes, List lines, String note, List attributes, CartBuyerIdentityInput? buyerIdentity, CartDeliveryInput? delivery }); -@override $CartBuyerIdentityInputCopyWith<$Res>? get buyerIdentity; +@override $CartBuyerIdentityInputCopyWith<$Res>? get buyerIdentity;@override $CartDeliveryInputCopyWith<$Res>? get delivery; } /// @nodoc @@ -302,14 +320,15 @@ class __$CartInputCopyWithImpl<$Res> /// Create a copy of CartInput /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? discountCodes = null,Object? lines = null,Object? note = null,Object? attributes = null,Object? buyerIdentity = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? discountCodes = null,Object? lines = null,Object? note = null,Object? attributes = null,Object? buyerIdentity = freezed,Object? delivery = freezed,}) { return _then(_CartInput( discountCodes: null == discountCodes ? _self._discountCodes : discountCodes // ignore: cast_nullable_to_non_nullable as List,lines: null == lines ? _self._lines : lines // ignore: cast_nullable_to_non_nullable as List,note: null == note ? _self.note : note // ignore: cast_nullable_to_non_nullable as String,attributes: null == attributes ? _self._attributes : attributes // ignore: cast_nullable_to_non_nullable as List,buyerIdentity: freezed == buyerIdentity ? _self.buyerIdentity : buyerIdentity // ignore: cast_nullable_to_non_nullable -as CartBuyerIdentityInput?, +as CartBuyerIdentityInput?,delivery: freezed == delivery ? _self.delivery : delivery // ignore: cast_nullable_to_non_nullable +as CartDeliveryInput?, )); } @@ -325,6 +344,18 @@ $CartBuyerIdentityInputCopyWith<$Res>? get buyerIdentity { return $CartBuyerIdentityInputCopyWith<$Res>(_self.buyerIdentity!, (value) { return _then(_self.copyWith(buyerIdentity: value)); }); +}/// Create a copy of CartInput +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartDeliveryInputCopyWith<$Res>? get delivery { + if (_self.delivery == null) { + return null; + } + + return $CartDeliveryInputCopyWith<$Res>(_self.delivery!, (value) { + return _then(_self.copyWith(delivery: value)); + }); } } diff --git a/lib/models/src/cart/inputs/cart_input/cart_input.g.dart b/lib/models/src/cart/inputs/cart_input/cart_input.g.dart index 37e2d521..cd27748f 100644 --- a/lib/models/src/cart/inputs/cart_input/cart_input.g.dart +++ b/lib/models/src/cart/inputs/cart_input/cart_input.g.dart @@ -36,6 +36,9 @@ _CartInput _$CartInputFromJson(Map json) => _CartInput( : CartBuyerIdentityInput.fromJson( json['buyerIdentity'] as Map, ), + delivery: json['delivery'] == null + ? null + : CartDeliveryInput.fromJson(json['delivery'] as Map), ); Map _$CartInputToJson(_CartInput instance) => @@ -45,4 +48,5 @@ Map _$CartInputToJson(_CartInput instance) => 'note': instance.note, 'attributes': instance.attributes.map((e) => e?.toJson()).toList(), 'buyerIdentity': instance.buyerIdentity?.toJson(), + 'delivery': instance.delivery?.toJson(), }; diff --git a/lib/models/src/cart/inputs/cart_inputs.dart b/lib/models/src/cart/inputs/cart_inputs.dart index 6634d191..3b10aebd 100644 --- a/lib/models/src/cart/inputs/cart_inputs.dart +++ b/lib/models/src/cart/inputs/cart_inputs.dart @@ -2,5 +2,8 @@ export 'cart_buyer_identity_input/cart_buyer_identity_input.dart'; export 'cart_input/cart_input.dart'; export 'cart_line_update_input/cart_line_update_input.dart'; export 'cart_line_input/cart_line_input.dart'; -export 'delivery_address_input/delivery_address_input.dart'; +export 'cart_delivery_input/cart_delivery_input.dart'; +export 'cart_selectable_address_input/cart_selectable_address_input.dart'; +export 'cart_address_input/cart_address_input.dart'; +export 'cart_delivery_address_input/cart_delivery_address_input.dart'; export 'mailing_address_input/mailing_address_input.dart'; diff --git a/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.dart b/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.dart new file mode 100644 index 00000000..04f7c1e7 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.dart @@ -0,0 +1,30 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../cart_address_input/cart_address_input.dart'; + +part 'cart_selectable_address_input.freezed.dart'; +part 'cart_selectable_address_input.g.dart'; + +@freezed + +/// A delivery address to present to the buyer on the cart. +abstract class CartSelectableAddressInput with _$CartSelectableAddressInput { + const CartSelectableAddressInput._(); + + /// The CartSelectableAddressInput constructor + const factory CartSelectableAddressInput({ + required CartAddressInput address, + + /// Pre-selects this address for the buyer. Exactly one address on a cart + /// can be selected. + bool? selected, + + /// When true, the address is not associated with the buyer after a + /// successful checkout. + bool? oneTimeUse, + }) = _CartSelectableAddressInput; + + /// The CartSelectableAddressInput from json factory + factory CartSelectableAddressInput.fromJson(Map json) => + _$CartSelectableAddressInputFromJson(json); +} diff --git a/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.freezed.dart b/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.freezed.dart new file mode 100644 index 00000000..15b601a6 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.freezed.dart @@ -0,0 +1,309 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cart_selectable_address_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$CartSelectableAddressInput { + + CartAddressInput get address;/// Pre-selects this address for the buyer. Exactly one address on a cart +/// can be selected. + bool? get selected;/// When true, the address is not associated with the buyer after a +/// successful checkout. + bool? get oneTimeUse; +/// Create a copy of CartSelectableAddressInput +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CartSelectableAddressInputCopyWith get copyWith => _$CartSelectableAddressInputCopyWithImpl(this as CartSelectableAddressInput, _$identity); + + /// Serializes this CartSelectableAddressInput to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CartSelectableAddressInput&&(identical(other.address, address) || other.address == address)&&(identical(other.selected, selected) || other.selected == selected)&&(identical(other.oneTimeUse, oneTimeUse) || other.oneTimeUse == oneTimeUse)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,address,selected,oneTimeUse); + +@override +String toString() { + return 'CartSelectableAddressInput(address: $address, selected: $selected, oneTimeUse: $oneTimeUse)'; +} + + +} + +/// @nodoc +abstract mixin class $CartSelectableAddressInputCopyWith<$Res> { + factory $CartSelectableAddressInputCopyWith(CartSelectableAddressInput value, $Res Function(CartSelectableAddressInput) _then) = _$CartSelectableAddressInputCopyWithImpl; +@useResult +$Res call({ + CartAddressInput address, bool? selected, bool? oneTimeUse +}); + + +$CartAddressInputCopyWith<$Res> get address; + +} +/// @nodoc +class _$CartSelectableAddressInputCopyWithImpl<$Res> + implements $CartSelectableAddressInputCopyWith<$Res> { + _$CartSelectableAddressInputCopyWithImpl(this._self, this._then); + + final CartSelectableAddressInput _self; + final $Res Function(CartSelectableAddressInput) _then; + +/// Create a copy of CartSelectableAddressInput +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? address = null,Object? selected = freezed,Object? oneTimeUse = freezed,}) { + return _then(_self.copyWith( +address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as CartAddressInput,selected: freezed == selected ? _self.selected : selected // ignore: cast_nullable_to_non_nullable +as bool?,oneTimeUse: freezed == oneTimeUse ? _self.oneTimeUse : oneTimeUse // ignore: cast_nullable_to_non_nullable +as bool?, + )); +} +/// Create a copy of CartSelectableAddressInput +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartAddressInputCopyWith<$Res> get address { + + return $CartAddressInputCopyWith<$Res>(_self.address, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [CartSelectableAddressInput]. +extension CartSelectableAddressInputPatterns on CartSelectableAddressInput { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _CartSelectableAddressInput value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CartSelectableAddressInput() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _CartSelectableAddressInput value) $default,){ +final _that = this; +switch (_that) { +case _CartSelectableAddressInput(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CartSelectableAddressInput value)? $default,){ +final _that = this; +switch (_that) { +case _CartSelectableAddressInput() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( CartAddressInput address, bool? selected, bool? oneTimeUse)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CartSelectableAddressInput() when $default != null: +return $default(_that.address,_that.selected,_that.oneTimeUse);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( CartAddressInput address, bool? selected, bool? oneTimeUse) $default,) {final _that = this; +switch (_that) { +case _CartSelectableAddressInput(): +return $default(_that.address,_that.selected,_that.oneTimeUse);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( CartAddressInput address, bool? selected, bool? oneTimeUse)? $default,) {final _that = this; +switch (_that) { +case _CartSelectableAddressInput() when $default != null: +return $default(_that.address,_that.selected,_that.oneTimeUse);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _CartSelectableAddressInput extends CartSelectableAddressInput { + const _CartSelectableAddressInput({required this.address, this.selected, this.oneTimeUse}): super._(); + factory _CartSelectableAddressInput.fromJson(Map json) => _$CartSelectableAddressInputFromJson(json); + +@override final CartAddressInput address; +/// Pre-selects this address for the buyer. Exactly one address on a cart +/// can be selected. +@override final bool? selected; +/// When true, the address is not associated with the buyer after a +/// successful checkout. +@override final bool? oneTimeUse; + +/// Create a copy of CartSelectableAddressInput +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CartSelectableAddressInputCopyWith<_CartSelectableAddressInput> get copyWith => __$CartSelectableAddressInputCopyWithImpl<_CartSelectableAddressInput>(this, _$identity); + +@override +Map toJson() { + return _$CartSelectableAddressInputToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartSelectableAddressInput&&(identical(other.address, address) || other.address == address)&&(identical(other.selected, selected) || other.selected == selected)&&(identical(other.oneTimeUse, oneTimeUse) || other.oneTimeUse == oneTimeUse)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,address,selected,oneTimeUse); + +@override +String toString() { + return 'CartSelectableAddressInput(address: $address, selected: $selected, oneTimeUse: $oneTimeUse)'; +} + + +} + +/// @nodoc +abstract mixin class _$CartSelectableAddressInputCopyWith<$Res> implements $CartSelectableAddressInputCopyWith<$Res> { + factory _$CartSelectableAddressInputCopyWith(_CartSelectableAddressInput value, $Res Function(_CartSelectableAddressInput) _then) = __$CartSelectableAddressInputCopyWithImpl; +@override @useResult +$Res call({ + CartAddressInput address, bool? selected, bool? oneTimeUse +}); + + +@override $CartAddressInputCopyWith<$Res> get address; + +} +/// @nodoc +class __$CartSelectableAddressInputCopyWithImpl<$Res> + implements _$CartSelectableAddressInputCopyWith<$Res> { + __$CartSelectableAddressInputCopyWithImpl(this._self, this._then); + + final _CartSelectableAddressInput _self; + final $Res Function(_CartSelectableAddressInput) _then; + +/// Create a copy of CartSelectableAddressInput +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? address = null,Object? selected = freezed,Object? oneTimeUse = freezed,}) { + return _then(_CartSelectableAddressInput( +address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as CartAddressInput,selected: freezed == selected ? _self.selected : selected // ignore: cast_nullable_to_non_nullable +as bool?,oneTimeUse: freezed == oneTimeUse ? _self.oneTimeUse : oneTimeUse // ignore: cast_nullable_to_non_nullable +as bool?, + )); +} + +/// Create a copy of CartSelectableAddressInput +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CartAddressInputCopyWith<$Res> get address { + + return $CartAddressInputCopyWith<$Res>(_self.address, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + +// dart format on diff --git a/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.g.dart b/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.g.dart new file mode 100644 index 00000000..ad841846 --- /dev/null +++ b/lib/models/src/cart/inputs/cart_selectable_address_input/cart_selectable_address_input.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cart_selectable_address_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CartSelectableAddressInput _$CartSelectableAddressInputFromJson( + Map json, +) => _CartSelectableAddressInput( + address: CartAddressInput.fromJson(json['address'] as Map), + selected: json['selected'] as bool?, + oneTimeUse: json['oneTimeUse'] as bool?, +); + +Map _$CartSelectableAddressInputToJson( + _CartSelectableAddressInput instance, +) => { + 'address': instance.address.toJson(), + 'selected': instance.selected, + 'oneTimeUse': instance.oneTimeUse, +}; diff --git a/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.dart b/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.dart deleted file mode 100644 index 010754b6..00000000 --- a/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; -import '../mailing_address_input/mailing_address_input.dart'; - -part 'delivery_address_input.freezed.dart'; -part 'delivery_address_input.g.dart'; - -@freezed - -/// The delivery address input -/// -/// Must not contain both [customerAddressId] and [deliveryAddress]. -/// -abstract class DeliveryAddressInput with _$DeliveryAddressInput { - const DeliveryAddressInput._(); - - @Assert('customerAddressId == null || deliveryAddress == null', - 'Cannot contain both customerAddressId and deliveryAddress') - - /// The delivery address input constructor - const factory DeliveryAddressInput({ - String? customerAddressId, - MailingAddressInput? deliveryAddress, - }) = _DeliveryAddressInput; - - /// The delivery address input from json factory - factory DeliveryAddressInput.fromJson(Map json) => - _$DeliveryAddressInputFromJson(json); -} diff --git a/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.freezed.dart b/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.freezed.dart deleted file mode 100644 index 4a818717..00000000 --- a/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.freezed.dart +++ /dev/null @@ -1,304 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'delivery_address_input.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$DeliveryAddressInput { - - String? get customerAddressId; MailingAddressInput? get deliveryAddress; -/// Create a copy of DeliveryAddressInput -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$DeliveryAddressInputCopyWith get copyWith => _$DeliveryAddressInputCopyWithImpl(this as DeliveryAddressInput, _$identity); - - /// Serializes this DeliveryAddressInput to a JSON map. - Map toJson(); - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeliveryAddressInput&&(identical(other.customerAddressId, customerAddressId) || other.customerAddressId == customerAddressId)&&(identical(other.deliveryAddress, deliveryAddress) || other.deliveryAddress == deliveryAddress)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,customerAddressId,deliveryAddress); - -@override -String toString() { - return 'DeliveryAddressInput(customerAddressId: $customerAddressId, deliveryAddress: $deliveryAddress)'; -} - - -} - -/// @nodoc -abstract mixin class $DeliveryAddressInputCopyWith<$Res> { - factory $DeliveryAddressInputCopyWith(DeliveryAddressInput value, $Res Function(DeliveryAddressInput) _then) = _$DeliveryAddressInputCopyWithImpl; -@useResult -$Res call({ - String? customerAddressId, MailingAddressInput? deliveryAddress -}); - - -$MailingAddressInputCopyWith<$Res>? get deliveryAddress; - -} -/// @nodoc -class _$DeliveryAddressInputCopyWithImpl<$Res> - implements $DeliveryAddressInputCopyWith<$Res> { - _$DeliveryAddressInputCopyWithImpl(this._self, this._then); - - final DeliveryAddressInput _self; - final $Res Function(DeliveryAddressInput) _then; - -/// Create a copy of DeliveryAddressInput -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? customerAddressId = freezed,Object? deliveryAddress = freezed,}) { - return _then(_self.copyWith( -customerAddressId: freezed == customerAddressId ? _self.customerAddressId : customerAddressId // ignore: cast_nullable_to_non_nullable -as String?,deliveryAddress: freezed == deliveryAddress ? _self.deliveryAddress : deliveryAddress // ignore: cast_nullable_to_non_nullable -as MailingAddressInput?, - )); -} -/// Create a copy of DeliveryAddressInput -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$MailingAddressInputCopyWith<$Res>? get deliveryAddress { - if (_self.deliveryAddress == null) { - return null; - } - - return $MailingAddressInputCopyWith<$Res>(_self.deliveryAddress!, (value) { - return _then(_self.copyWith(deliveryAddress: value)); - }); -} -} - - -/// Adds pattern-matching-related methods to [DeliveryAddressInput]. -extension DeliveryAddressInputPatterns on DeliveryAddressInput { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap(TResult Function( _DeliveryAddressInput value)? $default,{required TResult orElse(),}){ -final _that = this; -switch (_that) { -case _DeliveryAddressInput() when $default != null: -return $default(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map(TResult Function( _DeliveryAddressInput value) $default,){ -final _that = this; -switch (_that) { -case _DeliveryAddressInput(): -return $default(_that);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeliveryAddressInput value)? $default,){ -final _that = this; -switch (_that) { -case _DeliveryAddressInput() when $default != null: -return $default(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen(TResult Function( String? customerAddressId, MailingAddressInput? deliveryAddress)? $default,{required TResult orElse(),}) {final _that = this; -switch (_that) { -case _DeliveryAddressInput() when $default != null: -return $default(_that.customerAddressId,_that.deliveryAddress);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when(TResult Function( String? customerAddressId, MailingAddressInput? deliveryAddress) $default,) {final _that = this; -switch (_that) { -case _DeliveryAddressInput(): -return $default(_that.customerAddressId,_that.deliveryAddress);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? customerAddressId, MailingAddressInput? deliveryAddress)? $default,) {final _that = this; -switch (_that) { -case _DeliveryAddressInput() when $default != null: -return $default(_that.customerAddressId,_that.deliveryAddress);case _: - return null; - -} -} - -} - -/// @nodoc -@JsonSerializable() - -class _DeliveryAddressInput extends DeliveryAddressInput { - const _DeliveryAddressInput({this.customerAddressId, this.deliveryAddress}): assert(customerAddressId == null || deliveryAddress == null, 'Cannot contain both customerAddressId and deliveryAddress'),super._(); - factory _DeliveryAddressInput.fromJson(Map json) => _$DeliveryAddressInputFromJson(json); - -@override final String? customerAddressId; -@override final MailingAddressInput? deliveryAddress; - -/// Create a copy of DeliveryAddressInput -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -_$DeliveryAddressInputCopyWith<_DeliveryAddressInput> get copyWith => __$DeliveryAddressInputCopyWithImpl<_DeliveryAddressInput>(this, _$identity); - -@override -Map toJson() { - return _$DeliveryAddressInputToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeliveryAddressInput&&(identical(other.customerAddressId, customerAddressId) || other.customerAddressId == customerAddressId)&&(identical(other.deliveryAddress, deliveryAddress) || other.deliveryAddress == deliveryAddress)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,customerAddressId,deliveryAddress); - -@override -String toString() { - return 'DeliveryAddressInput(customerAddressId: $customerAddressId, deliveryAddress: $deliveryAddress)'; -} - - -} - -/// @nodoc -abstract mixin class _$DeliveryAddressInputCopyWith<$Res> implements $DeliveryAddressInputCopyWith<$Res> { - factory _$DeliveryAddressInputCopyWith(_DeliveryAddressInput value, $Res Function(_DeliveryAddressInput) _then) = __$DeliveryAddressInputCopyWithImpl; -@override @useResult -$Res call({ - String? customerAddressId, MailingAddressInput? deliveryAddress -}); - - -@override $MailingAddressInputCopyWith<$Res>? get deliveryAddress; - -} -/// @nodoc -class __$DeliveryAddressInputCopyWithImpl<$Res> - implements _$DeliveryAddressInputCopyWith<$Res> { - __$DeliveryAddressInputCopyWithImpl(this._self, this._then); - - final _DeliveryAddressInput _self; - final $Res Function(_DeliveryAddressInput) _then; - -/// Create a copy of DeliveryAddressInput -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? customerAddressId = freezed,Object? deliveryAddress = freezed,}) { - return _then(_DeliveryAddressInput( -customerAddressId: freezed == customerAddressId ? _self.customerAddressId : customerAddressId // ignore: cast_nullable_to_non_nullable -as String?,deliveryAddress: freezed == deliveryAddress ? _self.deliveryAddress : deliveryAddress // ignore: cast_nullable_to_non_nullable -as MailingAddressInput?, - )); -} - -/// Create a copy of DeliveryAddressInput -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$MailingAddressInputCopyWith<$Res>? get deliveryAddress { - if (_self.deliveryAddress == null) { - return null; - } - - return $MailingAddressInputCopyWith<$Res>(_self.deliveryAddress!, (value) { - return _then(_self.copyWith(deliveryAddress: value)); - }); -} -} - -// dart format on diff --git a/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.g.dart b/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.g.dart deleted file mode 100644 index 4b6e4b2a..00000000 --- a/lib/models/src/cart/inputs/delivery_address_input/delivery_address_input.g.dart +++ /dev/null @@ -1,25 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'delivery_address_input.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_DeliveryAddressInput _$DeliveryAddressInputFromJson( - Map json, -) => _DeliveryAddressInput( - customerAddressId: json['customerAddressId'] as String?, - deliveryAddress: json['deliveryAddress'] == null - ? null - : MailingAddressInput.fromJson( - json['deliveryAddress'] as Map, - ), -); - -Map _$DeliveryAddressInputToJson( - _DeliveryAddressInput instance, -) => { - 'customerAddressId': instance.customerAddressId, - 'deliveryAddress': instance.deliveryAddress?.toJson(), -}; diff --git a/lib/models/src/collection/collection.dart b/lib/models/src/collection/collection.dart index a048ecd9..95cbd87b 100644 --- a/lib/models/src/collection/collection.dart +++ b/lib/models/src/collection/collection.dart @@ -29,7 +29,7 @@ abstract class Collection with _$Collection { /// get imageUrl method String get imageUrl => image == null ? 'https://trello-attachments.s3.amazonaws.com/5d64f19a7cd71013a9a418cf/640x480/1dfc14f78ab0dbb3de0e62ae7ebded0c/placeholder.jpg' - : image!.originalSrc; + : image!.url; /// The collection from json factory Collection.fromGraphJson(Map json) { diff --git a/lib/models/src/localization/country/country.dart b/lib/models/src/localization/country/country.dart index e20c7e67..f0815cdc 100644 --- a/lib/models/src/localization/country/country.dart +++ b/lib/models/src/localization/country/country.dart @@ -1,7 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:shopify_flutter/models/src/localization/currency/currency.dart'; import 'package:shopify_flutter/models/src/localization/language/language.dart'; -import 'package:shopify_flutter/models/src/localization/market/market.dart'; part 'country.freezed.dart'; part 'country.g.dart'; @@ -12,7 +11,6 @@ part 'country.g.dart'; abstract class Country with _$Country { /// The country constructor const factory Country({ - required Market market, required List availableLanguages, required Currency currency, required String isoCode, diff --git a/lib/models/src/localization/country/country.freezed.dart b/lib/models/src/localization/country/country.freezed.dart index b1b88715..679181ce 100644 --- a/lib/models/src/localization/country/country.freezed.dart +++ b/lib/models/src/localization/country/country.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$Country { - Market get market; List get availableLanguages; Currency get currency; String get isoCode; String get name; String get unitSystem; + List get availableLanguages; Currency get currency; String get isoCode; String get name; String get unitSystem; /// Create a copy of Country /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $CountryCopyWith get copyWith => _$CountryCopyWithImpl(this as @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Country&&(identical(other.market, market) || other.market == market)&&const DeepCollectionEquality().equals(other.availableLanguages, availableLanguages)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.name, name) || other.name == name)&&(identical(other.unitSystem, unitSystem) || other.unitSystem == unitSystem)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is Country&&const DeepCollectionEquality().equals(other.availableLanguages, availableLanguages)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.name, name) || other.name == name)&&(identical(other.unitSystem, unitSystem) || other.unitSystem == unitSystem)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,market,const DeepCollectionEquality().hash(availableLanguages),currency,isoCode,name,unitSystem); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(availableLanguages),currency,isoCode,name,unitSystem); @override String toString() { - return 'Country(market: $market, availableLanguages: $availableLanguages, currency: $currency, isoCode: $isoCode, name: $name, unitSystem: $unitSystem)'; + return 'Country(availableLanguages: $availableLanguages, currency: $currency, isoCode: $isoCode, name: $name, unitSystem: $unitSystem)'; } @@ -48,11 +48,11 @@ abstract mixin class $CountryCopyWith<$Res> { factory $CountryCopyWith(Country value, $Res Function(Country) _then) = _$CountryCopyWithImpl; @useResult $Res call({ - Market market, List availableLanguages, Currency currency, String isoCode, String name, String unitSystem + List availableLanguages, Currency currency, String isoCode, String name, String unitSystem }); -$MarketCopyWith<$Res> get market;$CurrencyCopyWith<$Res> get currency; +$CurrencyCopyWith<$Res> get currency; } /// @nodoc @@ -65,10 +65,9 @@ class _$CountryCopyWithImpl<$Res> /// Create a copy of Country /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? market = null,Object? availableLanguages = null,Object? currency = null,Object? isoCode = null,Object? name = null,Object? unitSystem = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? availableLanguages = null,Object? currency = null,Object? isoCode = null,Object? name = null,Object? unitSystem = null,}) { return _then(_self.copyWith( -market: null == market ? _self.market : market // ignore: cast_nullable_to_non_nullable -as Market,availableLanguages: null == availableLanguages ? _self.availableLanguages : availableLanguages // ignore: cast_nullable_to_non_nullable +availableLanguages: null == availableLanguages ? _self.availableLanguages : availableLanguages // ignore: cast_nullable_to_non_nullable as List,currency: null == currency ? _self.currency : currency // ignore: cast_nullable_to_non_nullable as Currency,isoCode: null == isoCode ? _self.isoCode : isoCode // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable @@ -80,15 +79,6 @@ as String, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$MarketCopyWith<$Res> get market { - - return $MarketCopyWith<$Res>(_self.market, (value) { - return _then(_self.copyWith(market: value)); - }); -}/// Create a copy of Country -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') $CurrencyCopyWith<$Res> get currency { return $CurrencyCopyWith<$Res>(_self.currency, (value) { @@ -176,10 +166,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( Market market, List availableLanguages, Currency currency, String isoCode, String name, String unitSystem)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List availableLanguages, Currency currency, String isoCode, String name, String unitSystem)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _Country() when $default != null: -return $default(_that.market,_that.availableLanguages,_that.currency,_that.isoCode,_that.name,_that.unitSystem);case _: +return $default(_that.availableLanguages,_that.currency,_that.isoCode,_that.name,_that.unitSystem);case _: return orElse(); } @@ -197,10 +187,10 @@ return $default(_that.market,_that.availableLanguages,_that.currency,_that.isoCo /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( Market market, List availableLanguages, Currency currency, String isoCode, String name, String unitSystem) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List availableLanguages, Currency currency, String isoCode, String name, String unitSystem) $default,) {final _that = this; switch (_that) { case _Country(): -return $default(_that.market,_that.availableLanguages,_that.currency,_that.isoCode,_that.name,_that.unitSystem);case _: +return $default(_that.availableLanguages,_that.currency,_that.isoCode,_that.name,_that.unitSystem);case _: throw StateError('Unexpected subclass'); } @@ -217,10 +207,10 @@ return $default(_that.market,_that.availableLanguages,_that.currency,_that.isoCo /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( Market market, List availableLanguages, Currency currency, String isoCode, String name, String unitSystem)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List availableLanguages, Currency currency, String isoCode, String name, String unitSystem)? $default,) {final _that = this; switch (_that) { case _Country() when $default != null: -return $default(_that.market,_that.availableLanguages,_that.currency,_that.isoCode,_that.name,_that.unitSystem);case _: +return $default(_that.availableLanguages,_that.currency,_that.isoCode,_that.name,_that.unitSystem);case _: return null; } @@ -232,10 +222,9 @@ return $default(_that.market,_that.availableLanguages,_that.currency,_that.isoCo @JsonSerializable() class _Country implements Country { - const _Country({required this.market, required final List availableLanguages, required this.currency, required this.isoCode, required this.name, required this.unitSystem}): _availableLanguages = availableLanguages; + const _Country({required final List availableLanguages, required this.currency, required this.isoCode, required this.name, required this.unitSystem}): _availableLanguages = availableLanguages; factory _Country.fromJson(Map json) => _$CountryFromJson(json); -@override final Market market; final List _availableLanguages; @override List get availableLanguages { if (_availableLanguages is EqualUnmodifiableListView) return _availableLanguages; @@ -261,16 +250,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _Country&&(identical(other.market, market) || other.market == market)&&const DeepCollectionEquality().equals(other._availableLanguages, _availableLanguages)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.name, name) || other.name == name)&&(identical(other.unitSystem, unitSystem) || other.unitSystem == unitSystem)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Country&&const DeepCollectionEquality().equals(other._availableLanguages, _availableLanguages)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.name, name) || other.name == name)&&(identical(other.unitSystem, unitSystem) || other.unitSystem == unitSystem)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,market,const DeepCollectionEquality().hash(_availableLanguages),currency,isoCode,name,unitSystem); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_availableLanguages),currency,isoCode,name,unitSystem); @override String toString() { - return 'Country(market: $market, availableLanguages: $availableLanguages, currency: $currency, isoCode: $isoCode, name: $name, unitSystem: $unitSystem)'; + return 'Country(availableLanguages: $availableLanguages, currency: $currency, isoCode: $isoCode, name: $name, unitSystem: $unitSystem)'; } @@ -281,11 +270,11 @@ abstract mixin class _$CountryCopyWith<$Res> implements $CountryCopyWith<$Res> { factory _$CountryCopyWith(_Country value, $Res Function(_Country) _then) = __$CountryCopyWithImpl; @override @useResult $Res call({ - Market market, List availableLanguages, Currency currency, String isoCode, String name, String unitSystem + List availableLanguages, Currency currency, String isoCode, String name, String unitSystem }); -@override $MarketCopyWith<$Res> get market;@override $CurrencyCopyWith<$Res> get currency; +@override $CurrencyCopyWith<$Res> get currency; } /// @nodoc @@ -298,10 +287,9 @@ class __$CountryCopyWithImpl<$Res> /// Create a copy of Country /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? market = null,Object? availableLanguages = null,Object? currency = null,Object? isoCode = null,Object? name = null,Object? unitSystem = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? availableLanguages = null,Object? currency = null,Object? isoCode = null,Object? name = null,Object? unitSystem = null,}) { return _then(_Country( -market: null == market ? _self.market : market // ignore: cast_nullable_to_non_nullable -as Market,availableLanguages: null == availableLanguages ? _self._availableLanguages : availableLanguages // ignore: cast_nullable_to_non_nullable +availableLanguages: null == availableLanguages ? _self._availableLanguages : availableLanguages // ignore: cast_nullable_to_non_nullable as List,currency: null == currency ? _self.currency : currency // ignore: cast_nullable_to_non_nullable as Currency,isoCode: null == isoCode ? _self.isoCode : isoCode // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable @@ -314,15 +302,6 @@ as String, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$MarketCopyWith<$Res> get market { - - return $MarketCopyWith<$Res>(_self.market, (value) { - return _then(_self.copyWith(market: value)); - }); -}/// Create a copy of Country -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') $CurrencyCopyWith<$Res> get currency { return $CurrencyCopyWith<$Res>(_self.currency, (value) { diff --git a/lib/models/src/localization/country/country.g.dart b/lib/models/src/localization/country/country.g.dart index f4fb4bc1..1a4cc769 100644 --- a/lib/models/src/localization/country/country.g.dart +++ b/lib/models/src/localization/country/country.g.dart @@ -7,7 +7,6 @@ part of 'country.dart'; // ************************************************************************** _Country _$CountryFromJson(Map json) => _Country( - market: Market.fromJson(json['market'] as Map), availableLanguages: (json['availableLanguages'] as List) .map((e) => Language.fromJson(e as Map)) .toList(), @@ -18,7 +17,6 @@ _Country _$CountryFromJson(Map json) => _Country( ); Map _$CountryToJson(_Country instance) => { - 'market': instance.market.toJson(), 'availableLanguages': instance.availableLanguages .map((e) => e.toJson()) .toList(), diff --git a/lib/models/src/localization/localization.dart b/lib/models/src/localization/localization.dart index ba97cfd6..b3d89740 100644 --- a/lib/models/src/localization/localization.dart +++ b/lib/models/src/localization/localization.dart @@ -1,12 +1,11 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:shopify_flutter/models/src/localization/country/country.dart'; import 'package:shopify_flutter/models/src/localization/language/language.dart'; -import 'package:shopify_flutter/models/src/localization/market/market.dart'; part 'localization.freezed.dart'; part 'localization.g.dart'; -/// [Localizzation Object Doc](https://shopify.dev/docs/api/storefront/2024-04/objects/Localization) +/// [Localizzation Object Doc](https://shopify.dev/docs/api/storefront/2026-07/objects/Localization) @freezed /// The localization object @@ -17,7 +16,6 @@ abstract class Localization with _$Localization { required List availableCountries, required Language language, required Country country, - required Market market, }) = _Localization; /// The localization object from json diff --git a/lib/models/src/localization/localization.freezed.dart b/lib/models/src/localization/localization.freezed.dart index f9c5375a..28c127a5 100644 --- a/lib/models/src/localization/localization.freezed.dart +++ b/lib/models/src/localization/localization.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$Localization { - List get availableLanguages; List get availableCountries; Language get language; Country get country; Market get market; + List get availableLanguages; List get availableCountries; Language get language; Country get country; /// Create a copy of Localization /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $LocalizationCopyWith get copyWith => _$LocalizationCopyWithImpl Object.hash(runtimeType,const DeepCollectionEquality().hash(availableLanguages),const DeepCollectionEquality().hash(availableCountries),language,country,market); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(availableLanguages),const DeepCollectionEquality().hash(availableCountries),language,country); @override String toString() { - return 'Localization(availableLanguages: $availableLanguages, availableCountries: $availableCountries, language: $language, country: $country, market: $market)'; + return 'Localization(availableLanguages: $availableLanguages, availableCountries: $availableCountries, language: $language, country: $country)'; } @@ -48,11 +48,11 @@ abstract mixin class $LocalizationCopyWith<$Res> { factory $LocalizationCopyWith(Localization value, $Res Function(Localization) _then) = _$LocalizationCopyWithImpl; @useResult $Res call({ - List availableLanguages, List availableCountries, Language language, Country country, Market market + List availableLanguages, List availableCountries, Language language, Country country }); -$LanguageCopyWith<$Res> get language;$CountryCopyWith<$Res> get country;$MarketCopyWith<$Res> get market; +$LanguageCopyWith<$Res> get language;$CountryCopyWith<$Res> get country; } /// @nodoc @@ -65,14 +65,13 @@ class _$LocalizationCopyWithImpl<$Res> /// Create a copy of Localization /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? availableLanguages = null,Object? availableCountries = null,Object? language = null,Object? country = null,Object? market = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? availableLanguages = null,Object? availableCountries = null,Object? language = null,Object? country = null,}) { return _then(_self.copyWith( availableLanguages: null == availableLanguages ? _self.availableLanguages : availableLanguages // ignore: cast_nullable_to_non_nullable as List,availableCountries: null == availableCountries ? _self.availableCountries : availableCountries // ignore: cast_nullable_to_non_nullable as List,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable as Language,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable -as Country,market: null == market ? _self.market : market // ignore: cast_nullable_to_non_nullable -as Market, +as Country, )); } /// Create a copy of Localization @@ -93,15 +92,6 @@ $CountryCopyWith<$Res> get country { return $CountryCopyWith<$Res>(_self.country, (value) { return _then(_self.copyWith(country: value)); }); -}/// Create a copy of Localization -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$MarketCopyWith<$Res> get market { - - return $MarketCopyWith<$Res>(_self.market, (value) { - return _then(_self.copyWith(market: value)); - }); } } @@ -184,10 +174,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( List availableLanguages, List availableCountries, Language language, Country country, Market market)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List availableLanguages, List availableCountries, Language language, Country country)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _Localization() when $default != null: -return $default(_that.availableLanguages,_that.availableCountries,_that.language,_that.country,_that.market);case _: +return $default(_that.availableLanguages,_that.availableCountries,_that.language,_that.country);case _: return orElse(); } @@ -205,10 +195,10 @@ return $default(_that.availableLanguages,_that.availableCountries,_that.language /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( List availableLanguages, List availableCountries, Language language, Country country, Market market) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List availableLanguages, List availableCountries, Language language, Country country) $default,) {final _that = this; switch (_that) { case _Localization(): -return $default(_that.availableLanguages,_that.availableCountries,_that.language,_that.country,_that.market);case _: +return $default(_that.availableLanguages,_that.availableCountries,_that.language,_that.country);case _: throw StateError('Unexpected subclass'); } @@ -225,10 +215,10 @@ return $default(_that.availableLanguages,_that.availableCountries,_that.language /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( List availableLanguages, List availableCountries, Language language, Country country, Market market)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List availableLanguages, List availableCountries, Language language, Country country)? $default,) {final _that = this; switch (_that) { case _Localization() when $default != null: -return $default(_that.availableLanguages,_that.availableCountries,_that.language,_that.country,_that.market);case _: +return $default(_that.availableLanguages,_that.availableCountries,_that.language,_that.country);case _: return null; } @@ -240,7 +230,7 @@ return $default(_that.availableLanguages,_that.availableCountries,_that.language @JsonSerializable() class _Localization implements Localization { - const _Localization({required final List availableLanguages, required final List availableCountries, required this.language, required this.country, required this.market}): _availableLanguages = availableLanguages,_availableCountries = availableCountries; + const _Localization({required final List availableLanguages, required final List availableCountries, required this.language, required this.country}): _availableLanguages = availableLanguages,_availableCountries = availableCountries; factory _Localization.fromJson(Map json) => _$LocalizationFromJson(json); final List _availableLanguages; @@ -259,7 +249,6 @@ class _Localization implements Localization { @override final Language language; @override final Country country; -@override final Market market; /// Create a copy of Localization /// with the given fields replaced by the non-null parameter values. @@ -274,16 +263,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _Localization&&const DeepCollectionEquality().equals(other._availableLanguages, _availableLanguages)&&const DeepCollectionEquality().equals(other._availableCountries, _availableCountries)&&(identical(other.language, language) || other.language == language)&&(identical(other.country, country) || other.country == country)&&(identical(other.market, market) || other.market == market)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Localization&&const DeepCollectionEquality().equals(other._availableLanguages, _availableLanguages)&&const DeepCollectionEquality().equals(other._availableCountries, _availableCountries)&&(identical(other.language, language) || other.language == language)&&(identical(other.country, country) || other.country == country)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_availableLanguages),const DeepCollectionEquality().hash(_availableCountries),language,country,market); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_availableLanguages),const DeepCollectionEquality().hash(_availableCountries),language,country); @override String toString() { - return 'Localization(availableLanguages: $availableLanguages, availableCountries: $availableCountries, language: $language, country: $country, market: $market)'; + return 'Localization(availableLanguages: $availableLanguages, availableCountries: $availableCountries, language: $language, country: $country)'; } @@ -294,11 +283,11 @@ abstract mixin class _$LocalizationCopyWith<$Res> implements $LocalizationCopyWi factory _$LocalizationCopyWith(_Localization value, $Res Function(_Localization) _then) = __$LocalizationCopyWithImpl; @override @useResult $Res call({ - List availableLanguages, List availableCountries, Language language, Country country, Market market + List availableLanguages, List availableCountries, Language language, Country country }); -@override $LanguageCopyWith<$Res> get language;@override $CountryCopyWith<$Res> get country;@override $MarketCopyWith<$Res> get market; +@override $LanguageCopyWith<$Res> get language;@override $CountryCopyWith<$Res> get country; } /// @nodoc @@ -311,14 +300,13 @@ class __$LocalizationCopyWithImpl<$Res> /// Create a copy of Localization /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? availableLanguages = null,Object? availableCountries = null,Object? language = null,Object? country = null,Object? market = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? availableLanguages = null,Object? availableCountries = null,Object? language = null,Object? country = null,}) { return _then(_Localization( availableLanguages: null == availableLanguages ? _self._availableLanguages : availableLanguages // ignore: cast_nullable_to_non_nullable as List,availableCountries: null == availableCountries ? _self._availableCountries : availableCountries // ignore: cast_nullable_to_non_nullable as List,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable as Language,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable -as Country,market: null == market ? _self.market : market // ignore: cast_nullable_to_non_nullable -as Market, +as Country, )); } @@ -340,15 +328,6 @@ $CountryCopyWith<$Res> get country { return $CountryCopyWith<$Res>(_self.country, (value) { return _then(_self.copyWith(country: value)); }); -}/// Create a copy of Localization -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$MarketCopyWith<$Res> get market { - - return $MarketCopyWith<$Res>(_self.market, (value) { - return _then(_self.copyWith(market: value)); - }); } } diff --git a/lib/models/src/localization/localization.g.dart b/lib/models/src/localization/localization.g.dart index 2aea163c..806ee0c6 100644 --- a/lib/models/src/localization/localization.g.dart +++ b/lib/models/src/localization/localization.g.dart @@ -16,7 +16,6 @@ _Localization _$LocalizationFromJson(Map json) => .toList(), language: Language.fromJson(json['language'] as Map), country: Country.fromJson(json['country'] as Map), - market: Market.fromJson(json['market'] as Map), ); Map _$LocalizationToJson(_Localization instance) => @@ -29,5 +28,4 @@ Map _$LocalizationToJson(_Localization instance) => .toList(), 'language': instance.language.toJson(), 'country': instance.country.toJson(), - 'market': instance.market.toJson(), }; diff --git a/lib/models/src/localization/market/market.dart b/lib/models/src/localization/market/market.dart deleted file mode 100644 index b74d48a9..00000000 --- a/lib/models/src/localization/market/market.dart +++ /dev/null @@ -1,16 +0,0 @@ -// market.dart -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'market.freezed.dart'; -part 'market.g.dart'; - -@freezed - -/// The Market class -abstract class Market with _$Market { - /// The Market constructor - const factory Market({required String id, required String handle}) = _Market; - - /// The Market from json - factory Market.fromJson(Map json) => _$MarketFromJson(json); -} diff --git a/lib/models/src/localization/market/market.g.dart b/lib/models/src/localization/market/market.g.dart deleted file mode 100644 index d12cd471..00000000 --- a/lib/models/src/localization/market/market.g.dart +++ /dev/null @@ -1,15 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'market.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_Market _$MarketFromJson(Map json) => - _Market(id: json['id'] as String, handle: json['handle'] as String); - -Map _$MarketToJson(_Market instance) => { - 'id': instance.id, - 'handle': instance.handle, -}; diff --git a/lib/models/src/order/order.dart b/lib/models/src/order/order.dart index 5af9321a..0816d68b 100644 --- a/lib/models/src/order/order.dart +++ b/lib/models/src/order/order.dart @@ -27,13 +27,13 @@ abstract class Order with _$Order { required ShippingAddress? shippingAddress, required ShippingAddress? billingAddress, required String statusUrl, - required PriceV2 subtotalPriceV2, - required PriceV2 totalPriceV2, - required PriceV2 totalShippingPriceV2, - required PriceV2 totalTaxV2, + required PriceV2 subtotalPrice, + required PriceV2 totalPrice, + required PriceV2 totalShippingPrice, + required PriceV2 totalTax, required String financialStatus, required String fulfillmentStatus, - PriceV2? totalRefundedV2, + PriceV2? totalRefunded, String? phone, String? cursor, String? canceledAt, @@ -61,12 +61,12 @@ abstract class Order with _$Order { ? null : ShippingAddress.fromJson(json['node']['billingAddress']), statusUrl: json['node']['statusUrl'], - subtotalPriceV2: PriceV2.fromJson(json['node']['subtotalPriceV2']), - totalPriceV2: PriceV2.fromJson(json['node']['totalPriceV2']), - totalRefundedV2: PriceV2.fromJson(json['node']['totalRefundedV2']), - totalShippingPriceV2: - PriceV2.fromJson(json['node']['totalShippingPriceV2']), - totalTaxV2: PriceV2.fromJson(json['node']['totalTaxV2']), + subtotalPrice: PriceV2.fromJson(json['node']['subtotalPrice']), + totalPrice: PriceV2.fromJson(json['node']['totalPrice']), + totalRefunded: PriceV2.fromJson(json['node']['totalRefunded']), + totalShippingPrice: + PriceV2.fromJson(json['node']['totalShippingPrice']), + totalTax: PriceV2.fromJson(json['node']['totalTax']), cursor: json['cursor'], canceledAt: json['node']['canceledAt'], cancelReason: json['node']['cancelReason'], diff --git a/lib/models/src/order/order.freezed.dart b/lib/models/src/order/order.freezed.dart index 7e814c3e..7560983b 100644 --- a/lib/models/src/order/order.freezed.dart +++ b/lib/models/src/order/order.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$Order { - String get id; String get email; String get currencyCode; String get customerUrl; LineItemsOrder get lineItems; String get name; int get orderNumber; String get processedAt; ShippingAddress? get shippingAddress; ShippingAddress? get billingAddress; String get statusUrl; PriceV2 get subtotalPriceV2; PriceV2 get totalPriceV2; PriceV2 get totalShippingPriceV2; PriceV2 get totalTaxV2; String get financialStatus; String get fulfillmentStatus; PriceV2? get totalRefundedV2; String? get phone; String? get cursor; String? get canceledAt; String? get cancelReason; List? get successfulFulfillments; + String get id; String get email; String get currencyCode; String get customerUrl; LineItemsOrder get lineItems; String get name; int get orderNumber; String get processedAt; ShippingAddress? get shippingAddress; ShippingAddress? get billingAddress; String get statusUrl; PriceV2 get subtotalPrice; PriceV2 get totalPrice; PriceV2 get totalShippingPrice; PriceV2 get totalTax; String get financialStatus; String get fulfillmentStatus; PriceV2? get totalRefunded; String? get phone; String? get cursor; String? get canceledAt; String? get cancelReason; List? get successfulFulfillments; /// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $OrderCopyWith get copyWith => _$OrderCopyWithImpl(this as Order, @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Order&&(identical(other.id, id) || other.id == id)&&(identical(other.email, email) || other.email == email)&&(identical(other.currencyCode, currencyCode) || other.currencyCode == currencyCode)&&(identical(other.customerUrl, customerUrl) || other.customerUrl == customerUrl)&&(identical(other.lineItems, lineItems) || other.lineItems == lineItems)&&(identical(other.name, name) || other.name == name)&&(identical(other.orderNumber, orderNumber) || other.orderNumber == orderNumber)&&(identical(other.processedAt, processedAt) || other.processedAt == processedAt)&&(identical(other.shippingAddress, shippingAddress) || other.shippingAddress == shippingAddress)&&(identical(other.billingAddress, billingAddress) || other.billingAddress == billingAddress)&&(identical(other.statusUrl, statusUrl) || other.statusUrl == statusUrl)&&(identical(other.subtotalPriceV2, subtotalPriceV2) || other.subtotalPriceV2 == subtotalPriceV2)&&(identical(other.totalPriceV2, totalPriceV2) || other.totalPriceV2 == totalPriceV2)&&(identical(other.totalShippingPriceV2, totalShippingPriceV2) || other.totalShippingPriceV2 == totalShippingPriceV2)&&(identical(other.totalTaxV2, totalTaxV2) || other.totalTaxV2 == totalTaxV2)&&(identical(other.financialStatus, financialStatus) || other.financialStatus == financialStatus)&&(identical(other.fulfillmentStatus, fulfillmentStatus) || other.fulfillmentStatus == fulfillmentStatus)&&(identical(other.totalRefundedV2, totalRefundedV2) || other.totalRefundedV2 == totalRefundedV2)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.canceledAt, canceledAt) || other.canceledAt == canceledAt)&&(identical(other.cancelReason, cancelReason) || other.cancelReason == cancelReason)&&const DeepCollectionEquality().equals(other.successfulFulfillments, successfulFulfillments)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is Order&&(identical(other.id, id) || other.id == id)&&(identical(other.email, email) || other.email == email)&&(identical(other.currencyCode, currencyCode) || other.currencyCode == currencyCode)&&(identical(other.customerUrl, customerUrl) || other.customerUrl == customerUrl)&&(identical(other.lineItems, lineItems) || other.lineItems == lineItems)&&(identical(other.name, name) || other.name == name)&&(identical(other.orderNumber, orderNumber) || other.orderNumber == orderNumber)&&(identical(other.processedAt, processedAt) || other.processedAt == processedAt)&&(identical(other.shippingAddress, shippingAddress) || other.shippingAddress == shippingAddress)&&(identical(other.billingAddress, billingAddress) || other.billingAddress == billingAddress)&&(identical(other.statusUrl, statusUrl) || other.statusUrl == statusUrl)&&(identical(other.subtotalPrice, subtotalPrice) || other.subtotalPrice == subtotalPrice)&&(identical(other.totalPrice, totalPrice) || other.totalPrice == totalPrice)&&(identical(other.totalShippingPrice, totalShippingPrice) || other.totalShippingPrice == totalShippingPrice)&&(identical(other.totalTax, totalTax) || other.totalTax == totalTax)&&(identical(other.financialStatus, financialStatus) || other.financialStatus == financialStatus)&&(identical(other.fulfillmentStatus, fulfillmentStatus) || other.fulfillmentStatus == fulfillmentStatus)&&(identical(other.totalRefunded, totalRefunded) || other.totalRefunded == totalRefunded)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.canceledAt, canceledAt) || other.canceledAt == canceledAt)&&(identical(other.cancelReason, cancelReason) || other.cancelReason == cancelReason)&&const DeepCollectionEquality().equals(other.successfulFulfillments, successfulFulfillments)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hashAll([runtimeType,id,email,currencyCode,customerUrl,lineItems,name,orderNumber,processedAt,shippingAddress,billingAddress,statusUrl,subtotalPriceV2,totalPriceV2,totalShippingPriceV2,totalTaxV2,financialStatus,fulfillmentStatus,totalRefundedV2,phone,cursor,canceledAt,cancelReason,const DeepCollectionEquality().hash(successfulFulfillments)]); +int get hashCode => Object.hashAll([runtimeType,id,email,currencyCode,customerUrl,lineItems,name,orderNumber,processedAt,shippingAddress,billingAddress,statusUrl,subtotalPrice,totalPrice,totalShippingPrice,totalTax,financialStatus,fulfillmentStatus,totalRefunded,phone,cursor,canceledAt,cancelReason,const DeepCollectionEquality().hash(successfulFulfillments)]); @override String toString() { - return 'Order(id: $id, email: $email, currencyCode: $currencyCode, customerUrl: $customerUrl, lineItems: $lineItems, name: $name, orderNumber: $orderNumber, processedAt: $processedAt, shippingAddress: $shippingAddress, billingAddress: $billingAddress, statusUrl: $statusUrl, subtotalPriceV2: $subtotalPriceV2, totalPriceV2: $totalPriceV2, totalShippingPriceV2: $totalShippingPriceV2, totalTaxV2: $totalTaxV2, financialStatus: $financialStatus, fulfillmentStatus: $fulfillmentStatus, totalRefundedV2: $totalRefundedV2, phone: $phone, cursor: $cursor, canceledAt: $canceledAt, cancelReason: $cancelReason, successfulFulfillments: $successfulFulfillments)'; + return 'Order(id: $id, email: $email, currencyCode: $currencyCode, customerUrl: $customerUrl, lineItems: $lineItems, name: $name, orderNumber: $orderNumber, processedAt: $processedAt, shippingAddress: $shippingAddress, billingAddress: $billingAddress, statusUrl: $statusUrl, subtotalPrice: $subtotalPrice, totalPrice: $totalPrice, totalShippingPrice: $totalShippingPrice, totalTax: $totalTax, financialStatus: $financialStatus, fulfillmentStatus: $fulfillmentStatus, totalRefunded: $totalRefunded, phone: $phone, cursor: $cursor, canceledAt: $canceledAt, cancelReason: $cancelReason, successfulFulfillments: $successfulFulfillments)'; } @@ -48,11 +48,11 @@ abstract mixin class $OrderCopyWith<$Res> { factory $OrderCopyWith(Order value, $Res Function(Order) _then) = _$OrderCopyWithImpl; @useResult $Res call({ - String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPriceV2, PriceV2 totalPriceV2, PriceV2 totalShippingPriceV2, PriceV2 totalTaxV2, String financialStatus, String fulfillmentStatus, PriceV2? totalRefundedV2, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments + String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPrice, PriceV2 totalPrice, PriceV2 totalShippingPrice, PriceV2 totalTax, String financialStatus, String fulfillmentStatus, PriceV2? totalRefunded, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments }); -$LineItemsOrderCopyWith<$Res> get lineItems;$ShippingAddressCopyWith<$Res>? get shippingAddress;$ShippingAddressCopyWith<$Res>? get billingAddress;$PriceV2CopyWith<$Res> get subtotalPriceV2;$PriceV2CopyWith<$Res> get totalPriceV2;$PriceV2CopyWith<$Res> get totalShippingPriceV2;$PriceV2CopyWith<$Res> get totalTaxV2;$PriceV2CopyWith<$Res>? get totalRefundedV2; +$LineItemsOrderCopyWith<$Res> get lineItems;$ShippingAddressCopyWith<$Res>? get shippingAddress;$ShippingAddressCopyWith<$Res>? get billingAddress;$PriceV2CopyWith<$Res> get subtotalPrice;$PriceV2CopyWith<$Res> get totalPrice;$PriceV2CopyWith<$Res> get totalShippingPrice;$PriceV2CopyWith<$Res> get totalTax;$PriceV2CopyWith<$Res>? get totalRefunded; } /// @nodoc @@ -65,7 +65,7 @@ class _$OrderCopyWithImpl<$Res> /// Create a copy of Order /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? email = null,Object? currencyCode = null,Object? customerUrl = null,Object? lineItems = null,Object? name = null,Object? orderNumber = null,Object? processedAt = null,Object? shippingAddress = freezed,Object? billingAddress = freezed,Object? statusUrl = null,Object? subtotalPriceV2 = null,Object? totalPriceV2 = null,Object? totalShippingPriceV2 = null,Object? totalTaxV2 = null,Object? financialStatus = null,Object? fulfillmentStatus = null,Object? totalRefundedV2 = freezed,Object? phone = freezed,Object? cursor = freezed,Object? canceledAt = freezed,Object? cancelReason = freezed,Object? successfulFulfillments = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? email = null,Object? currencyCode = null,Object? customerUrl = null,Object? lineItems = null,Object? name = null,Object? orderNumber = null,Object? processedAt = null,Object? shippingAddress = freezed,Object? billingAddress = freezed,Object? statusUrl = null,Object? subtotalPrice = null,Object? totalPrice = null,Object? totalShippingPrice = null,Object? totalTax = null,Object? financialStatus = null,Object? fulfillmentStatus = null,Object? totalRefunded = freezed,Object? phone = freezed,Object? cursor = freezed,Object? canceledAt = freezed,Object? cancelReason = freezed,Object? successfulFulfillments = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable @@ -78,13 +78,13 @@ as int,processedAt: null == processedAt ? _self.processedAt : processedAt // ign as String,shippingAddress: freezed == shippingAddress ? _self.shippingAddress : shippingAddress // ignore: cast_nullable_to_non_nullable as ShippingAddress?,billingAddress: freezed == billingAddress ? _self.billingAddress : billingAddress // ignore: cast_nullable_to_non_nullable as ShippingAddress?,statusUrl: null == statusUrl ? _self.statusUrl : statusUrl // ignore: cast_nullable_to_non_nullable -as String,subtotalPriceV2: null == subtotalPriceV2 ? _self.subtotalPriceV2 : subtotalPriceV2 // ignore: cast_nullable_to_non_nullable -as PriceV2,totalPriceV2: null == totalPriceV2 ? _self.totalPriceV2 : totalPriceV2 // ignore: cast_nullable_to_non_nullable -as PriceV2,totalShippingPriceV2: null == totalShippingPriceV2 ? _self.totalShippingPriceV2 : totalShippingPriceV2 // ignore: cast_nullable_to_non_nullable -as PriceV2,totalTaxV2: null == totalTaxV2 ? _self.totalTaxV2 : totalTaxV2 // ignore: cast_nullable_to_non_nullable +as String,subtotalPrice: null == subtotalPrice ? _self.subtotalPrice : subtotalPrice // ignore: cast_nullable_to_non_nullable +as PriceV2,totalPrice: null == totalPrice ? _self.totalPrice : totalPrice // ignore: cast_nullable_to_non_nullable +as PriceV2,totalShippingPrice: null == totalShippingPrice ? _self.totalShippingPrice : totalShippingPrice // ignore: cast_nullable_to_non_nullable +as PriceV2,totalTax: null == totalTax ? _self.totalTax : totalTax // ignore: cast_nullable_to_non_nullable as PriceV2,financialStatus: null == financialStatus ? _self.financialStatus : financialStatus // ignore: cast_nullable_to_non_nullable as String,fulfillmentStatus: null == fulfillmentStatus ? _self.fulfillmentStatus : fulfillmentStatus // ignore: cast_nullable_to_non_nullable -as String,totalRefundedV2: freezed == totalRefundedV2 ? _self.totalRefundedV2 : totalRefundedV2 // ignore: cast_nullable_to_non_nullable +as String,totalRefunded: freezed == totalRefunded ? _self.totalRefunded : totalRefunded // ignore: cast_nullable_to_non_nullable as PriceV2?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,cursor: freezed == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable as String?,canceledAt: freezed == canceledAt ? _self.canceledAt : canceledAt // ignore: cast_nullable_to_non_nullable @@ -130,49 +130,49 @@ $ShippingAddressCopyWith<$Res>? get billingAddress { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get subtotalPriceV2 { +$PriceV2CopyWith<$Res> get subtotalPrice { - return $PriceV2CopyWith<$Res>(_self.subtotalPriceV2, (value) { - return _then(_self.copyWith(subtotalPriceV2: value)); + return $PriceV2CopyWith<$Res>(_self.subtotalPrice, (value) { + return _then(_self.copyWith(subtotalPrice: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get totalPriceV2 { +$PriceV2CopyWith<$Res> get totalPrice { - return $PriceV2CopyWith<$Res>(_self.totalPriceV2, (value) { - return _then(_self.copyWith(totalPriceV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalPrice, (value) { + return _then(_self.copyWith(totalPrice: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get totalShippingPriceV2 { +$PriceV2CopyWith<$Res> get totalShippingPrice { - return $PriceV2CopyWith<$Res>(_self.totalShippingPriceV2, (value) { - return _then(_self.copyWith(totalShippingPriceV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalShippingPrice, (value) { + return _then(_self.copyWith(totalShippingPrice: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get totalTaxV2 { +$PriceV2CopyWith<$Res> get totalTax { - return $PriceV2CopyWith<$Res>(_self.totalTaxV2, (value) { - return _then(_self.copyWith(totalTaxV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalTax, (value) { + return _then(_self.copyWith(totalTax: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res>? get totalRefundedV2 { - if (_self.totalRefundedV2 == null) { +$PriceV2CopyWith<$Res>? get totalRefunded { + if (_self.totalRefunded == null) { return null; } - return $PriceV2CopyWith<$Res>(_self.totalRefundedV2!, (value) { - return _then(_self.copyWith(totalRefundedV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalRefunded!, (value) { + return _then(_self.copyWith(totalRefunded: value)); }); } } @@ -256,10 +256,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPriceV2, PriceV2 totalPriceV2, PriceV2 totalShippingPriceV2, PriceV2 totalTaxV2, String financialStatus, String fulfillmentStatus, PriceV2? totalRefundedV2, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPrice, PriceV2 totalPrice, PriceV2 totalShippingPrice, PriceV2 totalTax, String financialStatus, String fulfillmentStatus, PriceV2? totalRefunded, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _Order() when $default != null: -return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that.lineItems,_that.name,_that.orderNumber,_that.processedAt,_that.shippingAddress,_that.billingAddress,_that.statusUrl,_that.subtotalPriceV2,_that.totalPriceV2,_that.totalShippingPriceV2,_that.totalTaxV2,_that.financialStatus,_that.fulfillmentStatus,_that.totalRefundedV2,_that.phone,_that.cursor,_that.canceledAt,_that.cancelReason,_that.successfulFulfillments);case _: +return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that.lineItems,_that.name,_that.orderNumber,_that.processedAt,_that.shippingAddress,_that.billingAddress,_that.statusUrl,_that.subtotalPrice,_that.totalPrice,_that.totalShippingPrice,_that.totalTax,_that.financialStatus,_that.fulfillmentStatus,_that.totalRefunded,_that.phone,_that.cursor,_that.canceledAt,_that.cancelReason,_that.successfulFulfillments);case _: return orElse(); } @@ -277,10 +277,10 @@ return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that. /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPriceV2, PriceV2 totalPriceV2, PriceV2 totalShippingPriceV2, PriceV2 totalTaxV2, String financialStatus, String fulfillmentStatus, PriceV2? totalRefundedV2, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPrice, PriceV2 totalPrice, PriceV2 totalShippingPrice, PriceV2 totalTax, String financialStatus, String fulfillmentStatus, PriceV2? totalRefunded, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments) $default,) {final _that = this; switch (_that) { case _Order(): -return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that.lineItems,_that.name,_that.orderNumber,_that.processedAt,_that.shippingAddress,_that.billingAddress,_that.statusUrl,_that.subtotalPriceV2,_that.totalPriceV2,_that.totalShippingPriceV2,_that.totalTaxV2,_that.financialStatus,_that.fulfillmentStatus,_that.totalRefundedV2,_that.phone,_that.cursor,_that.canceledAt,_that.cancelReason,_that.successfulFulfillments);case _: +return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that.lineItems,_that.name,_that.orderNumber,_that.processedAt,_that.shippingAddress,_that.billingAddress,_that.statusUrl,_that.subtotalPrice,_that.totalPrice,_that.totalShippingPrice,_that.totalTax,_that.financialStatus,_that.fulfillmentStatus,_that.totalRefunded,_that.phone,_that.cursor,_that.canceledAt,_that.cancelReason,_that.successfulFulfillments);case _: throw StateError('Unexpected subclass'); } @@ -297,10 +297,10 @@ return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that. /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPriceV2, PriceV2 totalPriceV2, PriceV2 totalShippingPriceV2, PriceV2 totalTaxV2, String financialStatus, String fulfillmentStatus, PriceV2? totalRefundedV2, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPrice, PriceV2 totalPrice, PriceV2 totalShippingPrice, PriceV2 totalTax, String financialStatus, String fulfillmentStatus, PriceV2? totalRefunded, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments)? $default,) {final _that = this; switch (_that) { case _Order() when $default != null: -return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that.lineItems,_that.name,_that.orderNumber,_that.processedAt,_that.shippingAddress,_that.billingAddress,_that.statusUrl,_that.subtotalPriceV2,_that.totalPriceV2,_that.totalShippingPriceV2,_that.totalTaxV2,_that.financialStatus,_that.fulfillmentStatus,_that.totalRefundedV2,_that.phone,_that.cursor,_that.canceledAt,_that.cancelReason,_that.successfulFulfillments);case _: +return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that.lineItems,_that.name,_that.orderNumber,_that.processedAt,_that.shippingAddress,_that.billingAddress,_that.statusUrl,_that.subtotalPrice,_that.totalPrice,_that.totalShippingPrice,_that.totalTax,_that.financialStatus,_that.fulfillmentStatus,_that.totalRefunded,_that.phone,_that.cursor,_that.canceledAt,_that.cancelReason,_that.successfulFulfillments);case _: return null; } @@ -312,7 +312,7 @@ return $default(_that.id,_that.email,_that.currencyCode,_that.customerUrl,_that. @JsonSerializable() class _Order extends Order { - const _Order({required this.id, required this.email, required this.currencyCode, required this.customerUrl, required this.lineItems, required this.name, required this.orderNumber, required this.processedAt, required this.shippingAddress, required this.billingAddress, required this.statusUrl, required this.subtotalPriceV2, required this.totalPriceV2, required this.totalShippingPriceV2, required this.totalTaxV2, required this.financialStatus, required this.fulfillmentStatus, this.totalRefundedV2, this.phone, this.cursor, this.canceledAt, this.cancelReason, final List? successfulFulfillments}): _successfulFulfillments = successfulFulfillments,super._(); + const _Order({required this.id, required this.email, required this.currencyCode, required this.customerUrl, required this.lineItems, required this.name, required this.orderNumber, required this.processedAt, required this.shippingAddress, required this.billingAddress, required this.statusUrl, required this.subtotalPrice, required this.totalPrice, required this.totalShippingPrice, required this.totalTax, required this.financialStatus, required this.fulfillmentStatus, this.totalRefunded, this.phone, this.cursor, this.canceledAt, this.cancelReason, final List? successfulFulfillments}): _successfulFulfillments = successfulFulfillments,super._(); factory _Order.fromJson(Map json) => _$OrderFromJson(json); @override final String id; @@ -326,13 +326,13 @@ class _Order extends Order { @override final ShippingAddress? shippingAddress; @override final ShippingAddress? billingAddress; @override final String statusUrl; -@override final PriceV2 subtotalPriceV2; -@override final PriceV2 totalPriceV2; -@override final PriceV2 totalShippingPriceV2; -@override final PriceV2 totalTaxV2; +@override final PriceV2 subtotalPrice; +@override final PriceV2 totalPrice; +@override final PriceV2 totalShippingPrice; +@override final PriceV2 totalTax; @override final String financialStatus; @override final String fulfillmentStatus; -@override final PriceV2? totalRefundedV2; +@override final PriceV2? totalRefunded; @override final String? phone; @override final String? cursor; @override final String? canceledAt; @@ -360,16 +360,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _Order&&(identical(other.id, id) || other.id == id)&&(identical(other.email, email) || other.email == email)&&(identical(other.currencyCode, currencyCode) || other.currencyCode == currencyCode)&&(identical(other.customerUrl, customerUrl) || other.customerUrl == customerUrl)&&(identical(other.lineItems, lineItems) || other.lineItems == lineItems)&&(identical(other.name, name) || other.name == name)&&(identical(other.orderNumber, orderNumber) || other.orderNumber == orderNumber)&&(identical(other.processedAt, processedAt) || other.processedAt == processedAt)&&(identical(other.shippingAddress, shippingAddress) || other.shippingAddress == shippingAddress)&&(identical(other.billingAddress, billingAddress) || other.billingAddress == billingAddress)&&(identical(other.statusUrl, statusUrl) || other.statusUrl == statusUrl)&&(identical(other.subtotalPriceV2, subtotalPriceV2) || other.subtotalPriceV2 == subtotalPriceV2)&&(identical(other.totalPriceV2, totalPriceV2) || other.totalPriceV2 == totalPriceV2)&&(identical(other.totalShippingPriceV2, totalShippingPriceV2) || other.totalShippingPriceV2 == totalShippingPriceV2)&&(identical(other.totalTaxV2, totalTaxV2) || other.totalTaxV2 == totalTaxV2)&&(identical(other.financialStatus, financialStatus) || other.financialStatus == financialStatus)&&(identical(other.fulfillmentStatus, fulfillmentStatus) || other.fulfillmentStatus == fulfillmentStatus)&&(identical(other.totalRefundedV2, totalRefundedV2) || other.totalRefundedV2 == totalRefundedV2)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.canceledAt, canceledAt) || other.canceledAt == canceledAt)&&(identical(other.cancelReason, cancelReason) || other.cancelReason == cancelReason)&&const DeepCollectionEquality().equals(other._successfulFulfillments, _successfulFulfillments)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Order&&(identical(other.id, id) || other.id == id)&&(identical(other.email, email) || other.email == email)&&(identical(other.currencyCode, currencyCode) || other.currencyCode == currencyCode)&&(identical(other.customerUrl, customerUrl) || other.customerUrl == customerUrl)&&(identical(other.lineItems, lineItems) || other.lineItems == lineItems)&&(identical(other.name, name) || other.name == name)&&(identical(other.orderNumber, orderNumber) || other.orderNumber == orderNumber)&&(identical(other.processedAt, processedAt) || other.processedAt == processedAt)&&(identical(other.shippingAddress, shippingAddress) || other.shippingAddress == shippingAddress)&&(identical(other.billingAddress, billingAddress) || other.billingAddress == billingAddress)&&(identical(other.statusUrl, statusUrl) || other.statusUrl == statusUrl)&&(identical(other.subtotalPrice, subtotalPrice) || other.subtotalPrice == subtotalPrice)&&(identical(other.totalPrice, totalPrice) || other.totalPrice == totalPrice)&&(identical(other.totalShippingPrice, totalShippingPrice) || other.totalShippingPrice == totalShippingPrice)&&(identical(other.totalTax, totalTax) || other.totalTax == totalTax)&&(identical(other.financialStatus, financialStatus) || other.financialStatus == financialStatus)&&(identical(other.fulfillmentStatus, fulfillmentStatus) || other.fulfillmentStatus == fulfillmentStatus)&&(identical(other.totalRefunded, totalRefunded) || other.totalRefunded == totalRefunded)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.canceledAt, canceledAt) || other.canceledAt == canceledAt)&&(identical(other.cancelReason, cancelReason) || other.cancelReason == cancelReason)&&const DeepCollectionEquality().equals(other._successfulFulfillments, _successfulFulfillments)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hashAll([runtimeType,id,email,currencyCode,customerUrl,lineItems,name,orderNumber,processedAt,shippingAddress,billingAddress,statusUrl,subtotalPriceV2,totalPriceV2,totalShippingPriceV2,totalTaxV2,financialStatus,fulfillmentStatus,totalRefundedV2,phone,cursor,canceledAt,cancelReason,const DeepCollectionEquality().hash(_successfulFulfillments)]); +int get hashCode => Object.hashAll([runtimeType,id,email,currencyCode,customerUrl,lineItems,name,orderNumber,processedAt,shippingAddress,billingAddress,statusUrl,subtotalPrice,totalPrice,totalShippingPrice,totalTax,financialStatus,fulfillmentStatus,totalRefunded,phone,cursor,canceledAt,cancelReason,const DeepCollectionEquality().hash(_successfulFulfillments)]); @override String toString() { - return 'Order(id: $id, email: $email, currencyCode: $currencyCode, customerUrl: $customerUrl, lineItems: $lineItems, name: $name, orderNumber: $orderNumber, processedAt: $processedAt, shippingAddress: $shippingAddress, billingAddress: $billingAddress, statusUrl: $statusUrl, subtotalPriceV2: $subtotalPriceV2, totalPriceV2: $totalPriceV2, totalShippingPriceV2: $totalShippingPriceV2, totalTaxV2: $totalTaxV2, financialStatus: $financialStatus, fulfillmentStatus: $fulfillmentStatus, totalRefundedV2: $totalRefundedV2, phone: $phone, cursor: $cursor, canceledAt: $canceledAt, cancelReason: $cancelReason, successfulFulfillments: $successfulFulfillments)'; + return 'Order(id: $id, email: $email, currencyCode: $currencyCode, customerUrl: $customerUrl, lineItems: $lineItems, name: $name, orderNumber: $orderNumber, processedAt: $processedAt, shippingAddress: $shippingAddress, billingAddress: $billingAddress, statusUrl: $statusUrl, subtotalPrice: $subtotalPrice, totalPrice: $totalPrice, totalShippingPrice: $totalShippingPrice, totalTax: $totalTax, financialStatus: $financialStatus, fulfillmentStatus: $fulfillmentStatus, totalRefunded: $totalRefunded, phone: $phone, cursor: $cursor, canceledAt: $canceledAt, cancelReason: $cancelReason, successfulFulfillments: $successfulFulfillments)'; } @@ -380,11 +380,11 @@ abstract mixin class _$OrderCopyWith<$Res> implements $OrderCopyWith<$Res> { factory _$OrderCopyWith(_Order value, $Res Function(_Order) _then) = __$OrderCopyWithImpl; @override @useResult $Res call({ - String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPriceV2, PriceV2 totalPriceV2, PriceV2 totalShippingPriceV2, PriceV2 totalTaxV2, String financialStatus, String fulfillmentStatus, PriceV2? totalRefundedV2, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments + String id, String email, String currencyCode, String customerUrl, LineItemsOrder lineItems, String name, int orderNumber, String processedAt, ShippingAddress? shippingAddress, ShippingAddress? billingAddress, String statusUrl, PriceV2 subtotalPrice, PriceV2 totalPrice, PriceV2 totalShippingPrice, PriceV2 totalTax, String financialStatus, String fulfillmentStatus, PriceV2? totalRefunded, String? phone, String? cursor, String? canceledAt, String? cancelReason, List? successfulFulfillments }); -@override $LineItemsOrderCopyWith<$Res> get lineItems;@override $ShippingAddressCopyWith<$Res>? get shippingAddress;@override $ShippingAddressCopyWith<$Res>? get billingAddress;@override $PriceV2CopyWith<$Res> get subtotalPriceV2;@override $PriceV2CopyWith<$Res> get totalPriceV2;@override $PriceV2CopyWith<$Res> get totalShippingPriceV2;@override $PriceV2CopyWith<$Res> get totalTaxV2;@override $PriceV2CopyWith<$Res>? get totalRefundedV2; +@override $LineItemsOrderCopyWith<$Res> get lineItems;@override $ShippingAddressCopyWith<$Res>? get shippingAddress;@override $ShippingAddressCopyWith<$Res>? get billingAddress;@override $PriceV2CopyWith<$Res> get subtotalPrice;@override $PriceV2CopyWith<$Res> get totalPrice;@override $PriceV2CopyWith<$Res> get totalShippingPrice;@override $PriceV2CopyWith<$Res> get totalTax;@override $PriceV2CopyWith<$Res>? get totalRefunded; } /// @nodoc @@ -397,7 +397,7 @@ class __$OrderCopyWithImpl<$Res> /// Create a copy of Order /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? email = null,Object? currencyCode = null,Object? customerUrl = null,Object? lineItems = null,Object? name = null,Object? orderNumber = null,Object? processedAt = null,Object? shippingAddress = freezed,Object? billingAddress = freezed,Object? statusUrl = null,Object? subtotalPriceV2 = null,Object? totalPriceV2 = null,Object? totalShippingPriceV2 = null,Object? totalTaxV2 = null,Object? financialStatus = null,Object? fulfillmentStatus = null,Object? totalRefundedV2 = freezed,Object? phone = freezed,Object? cursor = freezed,Object? canceledAt = freezed,Object? cancelReason = freezed,Object? successfulFulfillments = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? email = null,Object? currencyCode = null,Object? customerUrl = null,Object? lineItems = null,Object? name = null,Object? orderNumber = null,Object? processedAt = null,Object? shippingAddress = freezed,Object? billingAddress = freezed,Object? statusUrl = null,Object? subtotalPrice = null,Object? totalPrice = null,Object? totalShippingPrice = null,Object? totalTax = null,Object? financialStatus = null,Object? fulfillmentStatus = null,Object? totalRefunded = freezed,Object? phone = freezed,Object? cursor = freezed,Object? canceledAt = freezed,Object? cancelReason = freezed,Object? successfulFulfillments = freezed,}) { return _then(_Order( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable @@ -410,13 +410,13 @@ as int,processedAt: null == processedAt ? _self.processedAt : processedAt // ign as String,shippingAddress: freezed == shippingAddress ? _self.shippingAddress : shippingAddress // ignore: cast_nullable_to_non_nullable as ShippingAddress?,billingAddress: freezed == billingAddress ? _self.billingAddress : billingAddress // ignore: cast_nullable_to_non_nullable as ShippingAddress?,statusUrl: null == statusUrl ? _self.statusUrl : statusUrl // ignore: cast_nullable_to_non_nullable -as String,subtotalPriceV2: null == subtotalPriceV2 ? _self.subtotalPriceV2 : subtotalPriceV2 // ignore: cast_nullable_to_non_nullable -as PriceV2,totalPriceV2: null == totalPriceV2 ? _self.totalPriceV2 : totalPriceV2 // ignore: cast_nullable_to_non_nullable -as PriceV2,totalShippingPriceV2: null == totalShippingPriceV2 ? _self.totalShippingPriceV2 : totalShippingPriceV2 // ignore: cast_nullable_to_non_nullable -as PriceV2,totalTaxV2: null == totalTaxV2 ? _self.totalTaxV2 : totalTaxV2 // ignore: cast_nullable_to_non_nullable +as String,subtotalPrice: null == subtotalPrice ? _self.subtotalPrice : subtotalPrice // ignore: cast_nullable_to_non_nullable +as PriceV2,totalPrice: null == totalPrice ? _self.totalPrice : totalPrice // ignore: cast_nullable_to_non_nullable +as PriceV2,totalShippingPrice: null == totalShippingPrice ? _self.totalShippingPrice : totalShippingPrice // ignore: cast_nullable_to_non_nullable +as PriceV2,totalTax: null == totalTax ? _self.totalTax : totalTax // ignore: cast_nullable_to_non_nullable as PriceV2,financialStatus: null == financialStatus ? _self.financialStatus : financialStatus // ignore: cast_nullable_to_non_nullable as String,fulfillmentStatus: null == fulfillmentStatus ? _self.fulfillmentStatus : fulfillmentStatus // ignore: cast_nullable_to_non_nullable -as String,totalRefundedV2: freezed == totalRefundedV2 ? _self.totalRefundedV2 : totalRefundedV2 // ignore: cast_nullable_to_non_nullable +as String,totalRefunded: freezed == totalRefunded ? _self.totalRefunded : totalRefunded // ignore: cast_nullable_to_non_nullable as PriceV2?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,cursor: freezed == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable as String?,canceledAt: freezed == canceledAt ? _self.canceledAt : canceledAt // ignore: cast_nullable_to_non_nullable @@ -463,49 +463,49 @@ $ShippingAddressCopyWith<$Res>? get billingAddress { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get subtotalPriceV2 { +$PriceV2CopyWith<$Res> get subtotalPrice { - return $PriceV2CopyWith<$Res>(_self.subtotalPriceV2, (value) { - return _then(_self.copyWith(subtotalPriceV2: value)); + return $PriceV2CopyWith<$Res>(_self.subtotalPrice, (value) { + return _then(_self.copyWith(subtotalPrice: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get totalPriceV2 { +$PriceV2CopyWith<$Res> get totalPrice { - return $PriceV2CopyWith<$Res>(_self.totalPriceV2, (value) { - return _then(_self.copyWith(totalPriceV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalPrice, (value) { + return _then(_self.copyWith(totalPrice: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get totalShippingPriceV2 { +$PriceV2CopyWith<$Res> get totalShippingPrice { - return $PriceV2CopyWith<$Res>(_self.totalShippingPriceV2, (value) { - return _then(_self.copyWith(totalShippingPriceV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalShippingPrice, (value) { + return _then(_self.copyWith(totalShippingPrice: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res> get totalTaxV2 { +$PriceV2CopyWith<$Res> get totalTax { - return $PriceV2CopyWith<$Res>(_self.totalTaxV2, (value) { - return _then(_self.copyWith(totalTaxV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalTax, (value) { + return _then(_self.copyWith(totalTax: value)); }); }/// Create a copy of Order /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$PriceV2CopyWith<$Res>? get totalRefundedV2 { - if (_self.totalRefundedV2 == null) { +$PriceV2CopyWith<$Res>? get totalRefunded { + if (_self.totalRefunded == null) { return null; } - return $PriceV2CopyWith<$Res>(_self.totalRefundedV2!, (value) { - return _then(_self.copyWith(totalRefundedV2: value)); + return $PriceV2CopyWith<$Res>(_self.totalRefunded!, (value) { + return _then(_self.copyWith(totalRefunded: value)); }); } } diff --git a/lib/models/src/order/order.g.dart b/lib/models/src/order/order.g.dart index 217e9d9e..7f35aad7 100644 --- a/lib/models/src/order/order.g.dart +++ b/lib/models/src/order/order.g.dart @@ -26,19 +26,19 @@ _Order _$OrderFromJson(Map json) => _Order( json['billingAddress'] as Map, ), statusUrl: json['statusUrl'] as String, - subtotalPriceV2: PriceV2.fromJson( - json['subtotalPriceV2'] as Map, + subtotalPrice: PriceV2.fromJson( + json['subtotalPrice'] as Map, ), - totalPriceV2: PriceV2.fromJson(json['totalPriceV2'] as Map), - totalShippingPriceV2: PriceV2.fromJson( - json['totalShippingPriceV2'] as Map, + totalPrice: PriceV2.fromJson(json['totalPrice'] as Map), + totalShippingPrice: PriceV2.fromJson( + json['totalShippingPrice'] as Map, ), - totalTaxV2: PriceV2.fromJson(json['totalTaxV2'] as Map), + totalTax: PriceV2.fromJson(json['totalTax'] as Map), financialStatus: json['financialStatus'] as String, fulfillmentStatus: json['fulfillmentStatus'] as String, - totalRefundedV2: json['totalRefundedV2'] == null + totalRefunded: json['totalRefunded'] == null ? null - : PriceV2.fromJson(json['totalRefundedV2'] as Map), + : PriceV2.fromJson(json['totalRefunded'] as Map), phone: json['phone'] as String?, cursor: json['cursor'] as String?, canceledAt: json['canceledAt'] as String?, @@ -60,13 +60,13 @@ Map _$OrderToJson(_Order instance) => { 'shippingAddress': instance.shippingAddress?.toJson(), 'billingAddress': instance.billingAddress?.toJson(), 'statusUrl': instance.statusUrl, - 'subtotalPriceV2': instance.subtotalPriceV2.toJson(), - 'totalPriceV2': instance.totalPriceV2.toJson(), - 'totalShippingPriceV2': instance.totalShippingPriceV2.toJson(), - 'totalTaxV2': instance.totalTaxV2.toJson(), + 'subtotalPrice': instance.subtotalPrice.toJson(), + 'totalPrice': instance.totalPrice.toJson(), + 'totalShippingPrice': instance.totalShippingPrice.toJson(), + 'totalTax': instance.totalTax.toJson(), 'financialStatus': instance.financialStatus, 'fulfillmentStatus': instance.fulfillmentStatus, - 'totalRefundedV2': instance.totalRefundedV2?.toJson(), + 'totalRefunded': instance.totalRefunded?.toJson(), 'phone': instance.phone, 'cursor': instance.cursor, 'canceledAt': instance.canceledAt, diff --git a/lib/models/src/product/option/option.dart b/lib/models/src/product/option/option.dart index 90c7948c..bd8ba121 100644 --- a/lib/models/src/product/option/option.dart +++ b/lib/models/src/product/option/option.dart @@ -1,4 +1,5 @@ import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:shopify_flutter/models/src/product/product_option_value/product_option_value.dart'; part 'option.freezed.dart'; part 'option.g.dart'; @@ -13,7 +14,7 @@ abstract class Option with _$Option { const factory Option({ required String id, required String name, - required List values, + required List optionValues, }) = _Option; /// The Option from json diff --git a/lib/models/src/product/option/option.freezed.dart b/lib/models/src/product/option/option.freezed.dart index 7b55c70b..b1d57ea4 100644 --- a/lib/models/src/product/option/option.freezed.dart +++ b/lib/models/src/product/option/option.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$Option { - String get id; String get name; List get values; + String get id; String get name; List get optionValues; /// Create a copy of Option /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $OptionCopyWith