Skip to content

Commit

Permalink
[Patch 0.10.1] Fix PixelEvent types (#120)
Browse files Browse the repository at this point in the history
* Add missing Codable type, clean comments on types

* bump: patch
  • Loading branch information
markmur authored Jan 26, 2024
1 parent 9e1d534 commit 5e12b52
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 83 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.10.1 - January 26, 2024

- Clean Web Pixel types - #120 (@markmur)

## 0.10.0 - January 26, 2024

- Expose Web Pixel events via new `checkoutDidEmitWebPixelEvent` hook - #101, #103, #105, #107, #112 (@josemiguel-alvarez, @kiftio , @markmur)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The SDK is an open-source [Swift Package library](https://www.swift.org/package-

```swift
dependencies: [
.package(url: "https://github.com/Shopify/checkout-sheet-kit-swift", from: "0.10.0")
.package(url: "https://github.com/Shopify/checkout-sheet-kit-swift", from: "0.10")
]
```

Expand All @@ -35,7 +35,7 @@ For more details on managing Swift Package dependencies in Xcode, please see [Ap
#### CocoaPods

```ruby
pod "ShopifyCheckoutSheetKit", "~> 0.10.0"
pod "ShopifyCheckoutSheetKit", "~> 0.10"
```

For more information on CocoaPods, please see their [getting started guide](https://guides.cocoapods.org/using/getting-started.html).
Expand Down
2 changes: 1 addition & 1 deletion ShopifyCheckoutSheetKit.podspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Pod::Spec.new do |s|
s.version = "0.10.0"
s.version = "0.10.1"

s.name = "ShopifyCheckoutSheetKit"
s.summary = "Enables Swift apps to embed the Shopify's highest converting, customizable, one-page checkout."
Expand Down
82 changes: 2 additions & 80 deletions Sources/ShopifyCheckoutSheetKit/PixelEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public struct StandardEventData: Codable {

/// This event represents any custom events emitted by partners or merchants via
/// the `publish` method
public struct CustomEvent {
public struct CustomEvent: Codable {
public let context: Context?
public let customData: String?
/// The ID of the customer event
Expand Down Expand Up @@ -87,9 +87,6 @@ public struct Context: Codable {

// MARK: - WebPixelsDocument

/// Snapshot of a subset of properties of the `document` object in the top
/// frame of the browser
///
/// A snapshot of a subset of properties of the `document` object in the top
/// frame of the browser
public struct WebPixelsDocument: Codable {
Expand All @@ -109,13 +106,7 @@ public struct WebPixelsDocument: Codable {

// MARK: - Location

/// Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document),
/// returns the URI of the current document
///
/// A snapshot of a subset of properties of the `location` object in the top
/// frame of the browser
///
/// Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), the
/// Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), the
/// location, or current URL, of the window object
public struct Location: Codable {
/// Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
Expand Down Expand Up @@ -158,9 +149,6 @@ public struct Location: Codable {

// MARK: - WebPixelsNavigator

/// Snapshot of a subset of properties of the `navigator` object in the top
/// frame of the browser
///
/// A snapshot of a subset of properties of the `navigator` object in the top
/// frame of the browser
public struct WebPixelsNavigator: Codable {
Expand All @@ -183,9 +171,6 @@ public struct WebPixelsNavigator: Codable {

// MARK: - WebPixelsWindow

/// Snapshot of a subset of properties of the `window` object in the top frame
/// of the browser
///
/// A snapshot of a subset of properties of the `window` object in the top frame
/// of the browser
public struct WebPixelsWindow: Codable {
Expand Down Expand Up @@ -237,10 +222,6 @@ public struct WebPixelsWindow: Codable {

// MARK: - Screen

/// Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Screen), the
/// interface representing a screen, usually the one on which the current
/// window is being rendered
///
/// The interface representing a screen, usually the one on which the current
/// window is being rendered
public struct Screen: Codable {
Expand All @@ -254,26 +235,6 @@ public struct Screen: Codable {

// MARK: - MoneyV2

/// The total amount for the customer to pay.
///
/// A monetary value with currency.
///
/// The total cost of the merchandise line.
///
/// The product variant’s price.
///
/// The monetary value with currency allocated to the discount.
///
/// Price of this shipping rate.
///
/// The price at checkout before duties, shipping, and taxes.
///
/// The sum of all the prices of all the items in the checkout, including
/// duties, taxes, and discounts.
///
/// The sum of all the taxes applied to the line items and shipping lines in
/// the checkout.
///
/// The monetary value with currency allocated to the transaction method.
public struct MoneyV2: Codable {
/// The decimal money amount.
Expand All @@ -299,9 +260,6 @@ public struct CartLine: Codable {

// MARK: - CartLineCost

/// The cost of the merchandise that the customer will pay for at checkout. The
/// costs are subject to change and changes will be reflected at checkout.
///
/// The cost of the merchandise line that the customer will pay at checkout.
public struct CartLineCost: Codable {
/// The total cost of the merchandise line.
Expand All @@ -310,8 +268,6 @@ public struct CartLineCost: Codable {

// MARK: - ProductVariant

/// The merchandise that the buyer intends to purchase.
///
/// A product variant represents a different version of a product, such as
/// differing sizes or differing colors.
public struct ProductVariant: Codable {
Expand Down Expand Up @@ -342,8 +298,6 @@ public struct Image: Codable {

// MARK: - Product

/// The product object that the product variant belongs to.
///
/// A product is an individual item for sale in a Shopify store.
public struct Product: Codable {
/// The ID of the product.
Expand Down Expand Up @@ -493,31 +447,6 @@ public struct DiscountApplication: Codable {

// MARK: - Value

/// The value of the discount. Fixed discounts return a `Money` Object, while
/// Percentage discounts return a `PricingPercentageValue` object.
///
/// The total amount for the customer to pay.
///
/// A monetary value with currency.
///
/// The total cost of the merchandise line.
///
/// The product variant’s price.
///
/// The monetary value with currency allocated to the discount.
///
/// Price of this shipping rate.
///
/// The price at checkout before duties, shipping, and taxes.
///
/// The sum of all the prices of all the items in the checkout, including
/// duties, taxes, and discounts.
///
/// The sum of all the taxes applied to the line items and shipping lines in
/// the checkout.
///
/// The monetary value with currency allocated to the transaction method.
///
/// A value given to a customer when a discount is applied to an order. The
/// application of a discount with this value gives the customer the specified
/// percentage off a specified item.
Expand Down Expand Up @@ -643,13 +572,6 @@ public struct PricingPercentageValue: Codable {
let percentage: Double?
}

// swiftlint:disable type_name
typealias ID = String
// swiftlint:enable type_name

typealias Name = String
typealias Timestamp = String

// MARK: - Helper functions for creating encoders and decoders

func newJSONDecoder() -> JSONDecoder {
Expand Down

0 comments on commit 5e12b52

Please sign in to comment.