@anglerai/react-native-analytics 0.0.0-stage → 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnglerAnalyticsRN.podspec +25 -0
- package/LICENSE +21 -0
- package/README.md +92 -2
- package/android/build.gradle +64 -0
- package/android/src/main/java/ai/getangler/analytics/reactnative/AnglerAnalyticsModule.kt +51 -0
- package/android/src/main/java/ai/getangler/analytics/reactnative/AnglerAnalyticsPackage.kt +25 -0
- package/android/src/main/java/ai/getangler/analytics/reactnative/ConfigParser.kt +58 -0
- package/android/src/test/java/ai/getangler/analytics/reactnative/ConfigParserTest.kt +51 -0
- package/ios/AnglerAnalyticsBridge.swift +58 -0
- package/ios/AnglerAnalyticsRN.mm +84 -0
- package/ios/vendor/AnglerAnalytics/Angler.swift +132 -0
- package/ios/vendor/AnglerAnalytics/AnglerCore.swift +398 -0
- package/ios/vendor/AnglerAnalytics/Attribution/AttributionStore.swift +109 -0
- package/ios/vendor/AnglerAnalytics/Attribution/ClickIdParser.swift +52 -0
- package/ios/vendor/AnglerAnalytics/Device/AdIdProvider.swift +36 -0
- package/ios/vendor/AnglerAnalytics/Device/DeviceContext.swift +111 -0
- package/ios/vendor/AnglerAnalytics/Device/FirebaseIdProvider.swift +35 -0
- package/ios/vendor/AnglerAnalytics/Lifecycle/LifecycleObserver.swift +77 -0
- package/ios/vendor/AnglerAnalytics/Lifecycle/SharedApplication.swift +15 -0
- package/ios/vendor/AnglerAnalytics/Log.swift +24 -0
- package/ios/vendor/AnglerAnalytics/Network/Flusher.swift +112 -0
- package/ios/vendor/AnglerAnalytics/Network/ResponsePolicy.swift +29 -0
- package/ios/vendor/AnglerAnalytics/Network/Scheduler.swift +13 -0
- package/ios/vendor/AnglerAnalytics/Network/Transport.swift +55 -0
- package/ios/vendor/AnglerAnalytics/Payload/JSONValue.swift +81 -0
- package/ios/vendor/AnglerAnalytics/Payload/Models.generated.swift +580 -0
- package/ios/vendor/AnglerAnalytics/Payload/PayloadBuilder.swift +148 -0
- package/ios/vendor/AnglerAnalytics/Payload/StandardEvent.swift +26 -0
- package/ios/vendor/AnglerAnalytics/Payload/TypedModels.swift +14 -0
- package/ios/vendor/AnglerAnalytics/Resources/PrivacyInfo.xcprivacy +77 -0
- package/ios/vendor/AnglerAnalytics/Storage/Clock.swift +14 -0
- package/ios/vendor/AnglerAnalytics/Storage/EventQueue.swift +85 -0
- package/ios/vendor/AnglerAnalytics/Storage/IdentityStore.swift +76 -0
- package/ios/vendor/AnglerAnalytics/Storage/KeyValueStore.swift +38 -0
- package/ios/vendor/AnglerAnalytics/Version.swift +4 -0
- package/package.json +46 -4
- package/src/NativeAnglerAnalytics.ts +21 -0
- package/src/index.ts +159 -0
- package/src/models.generated.ts +347 -0
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
// Generated by scripts/generate-models.mjs from data-api's events schema (data-api d36fffc).
|
|
2
|
+
// Don't edit: re-export the schema and run the generator.
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
|
|
6
|
+
/// A standard event name data-api accepts, or `.custom` for any other name.
|
|
7
|
+
public enum AnglerEvent: Hashable {
|
|
8
|
+
case appInstalled
|
|
9
|
+
case appLaunched
|
|
10
|
+
case cartViewed
|
|
11
|
+
case checkoutAddressInfoSubmitted
|
|
12
|
+
case checkoutCompleted
|
|
13
|
+
case checkoutContactInfoSubmitted
|
|
14
|
+
case checkoutShippingInfoSubmitted
|
|
15
|
+
case checkoutStarted
|
|
16
|
+
case collectionViewed
|
|
17
|
+
case formSubmitted
|
|
18
|
+
case loggedIn
|
|
19
|
+
case pageViewed
|
|
20
|
+
case paymentInfoSubmitted
|
|
21
|
+
case productAddedToCart
|
|
22
|
+
case productRemovedFromCart
|
|
23
|
+
case productViewed
|
|
24
|
+
case registrationCompleted
|
|
25
|
+
case searchSubmitted
|
|
26
|
+
/// Any other name; sent as `custom_event` with this `custom_event_name`.
|
|
27
|
+
case custom(String)
|
|
28
|
+
|
|
29
|
+
/// The name sent to data-api.
|
|
30
|
+
public var name: String {
|
|
31
|
+
switch self {
|
|
32
|
+
case .appInstalled: return "app_installed"
|
|
33
|
+
case .appLaunched: return "app_launched"
|
|
34
|
+
case .cartViewed: return "cart_viewed"
|
|
35
|
+
case .checkoutAddressInfoSubmitted: return "checkout_address_info_submitted"
|
|
36
|
+
case .checkoutCompleted: return "checkout_completed"
|
|
37
|
+
case .checkoutContactInfoSubmitted: return "checkout_contact_info_submitted"
|
|
38
|
+
case .checkoutShippingInfoSubmitted: return "checkout_shipping_info_submitted"
|
|
39
|
+
case .checkoutStarted: return "checkout_started"
|
|
40
|
+
case .collectionViewed: return "collection_viewed"
|
|
41
|
+
case .formSubmitted: return "form_submitted"
|
|
42
|
+
case .loggedIn: return "logged_in"
|
|
43
|
+
case .pageViewed: return "page_viewed"
|
|
44
|
+
case .paymentInfoSubmitted: return "payment_info_submitted"
|
|
45
|
+
case .productAddedToCart: return "product_added_to_cart"
|
|
46
|
+
case .productRemovedFromCart: return "product_removed_from_cart"
|
|
47
|
+
case .productViewed: return "product_viewed"
|
|
48
|
+
case .registrationCompleted: return "registration_completed"
|
|
49
|
+
case .searchSubmitted: return "search_submitted"
|
|
50
|
+
case .custom(let name): return name
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// An event's data: the commerce objects it refers to, plus custom name/value pairs.
|
|
56
|
+
public struct AnglerData: Encodable, Equatable {
|
|
57
|
+
public var cart: AnglerCart?
|
|
58
|
+
/// Represents information about the merchandise in the cart.
|
|
59
|
+
public var cartLine: AnglerCartLine?
|
|
60
|
+
public var checkout: AnglerCheckout?
|
|
61
|
+
public var collection: AnglerCollection?
|
|
62
|
+
/// Product variant of the line item.
|
|
63
|
+
public var productVariant: AnglerProductVariant?
|
|
64
|
+
public var searchResult: AnglerSearchResult?
|
|
65
|
+
public var customer: AnglerCustomer?
|
|
66
|
+
public var form: AnglerFormElement?
|
|
67
|
+
public var contacts: [AnglerCustomer]?
|
|
68
|
+
public var customData: [AnglerCustomValue]?
|
|
69
|
+
|
|
70
|
+
public init(cart: AnglerCart? = nil, cartLine: AnglerCartLine? = nil, checkout: AnglerCheckout? = nil, collection: AnglerCollection? = nil, productVariant: AnglerProductVariant? = nil, searchResult: AnglerSearchResult? = nil, customer: AnglerCustomer? = nil, form: AnglerFormElement? = nil, contacts: [AnglerCustomer]? = nil, customData: [AnglerCustomValue]? = nil) {
|
|
71
|
+
self.cart = cart
|
|
72
|
+
self.cartLine = cartLine
|
|
73
|
+
self.checkout = checkout
|
|
74
|
+
self.collection = collection
|
|
75
|
+
self.productVariant = productVariant
|
|
76
|
+
self.searchResult = searchResult
|
|
77
|
+
self.customer = customer
|
|
78
|
+
self.form = form
|
|
79
|
+
self.contacts = contacts
|
|
80
|
+
self.customData = customData
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public struct AnglerCart: Encodable, Equatable {
|
|
85
|
+
/// The estimated costs that the customer will pay at checkout.
|
|
86
|
+
public var cost: AnglerCartCost?
|
|
87
|
+
/// A globally unique identifier.
|
|
88
|
+
public var id: String?
|
|
89
|
+
public var lines: [AnglerCartLine]?
|
|
90
|
+
/// The total number of items in the cart.
|
|
91
|
+
public var totalQuantity: Double?
|
|
92
|
+
|
|
93
|
+
public init(cost: AnglerCartCost? = nil, id: String? = nil, lines: [AnglerCartLine]? = nil, totalQuantity: Double? = nil) {
|
|
94
|
+
self.cost = cost
|
|
95
|
+
self.id = id
|
|
96
|
+
self.lines = lines
|
|
97
|
+
self.totalQuantity = totalQuantity
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// The estimated costs that the customer will pay at checkout.
|
|
102
|
+
public struct AnglerCartCost: Encodable, Equatable {
|
|
103
|
+
/// A monetary value with currency.
|
|
104
|
+
public var totalAmount: AnglerMoney?
|
|
105
|
+
|
|
106
|
+
public init(totalAmount: AnglerMoney? = nil) {
|
|
107
|
+
self.totalAmount = totalAmount
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// A monetary value with currency.
|
|
112
|
+
public struct AnglerMoney: Encodable, Equatable {
|
|
113
|
+
/// Decimal money amount.
|
|
114
|
+
public var amount: Double?
|
|
115
|
+
/// Currency of the money.
|
|
116
|
+
public var currencyCode: String?
|
|
117
|
+
|
|
118
|
+
public init(amount: Double? = nil, currencyCode: String? = nil) {
|
|
119
|
+
self.amount = amount
|
|
120
|
+
self.currencyCode = currencyCode
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// Represents information about the merchandise in the cart.
|
|
125
|
+
public struct AnglerCartLine: Encodable, Equatable {
|
|
126
|
+
/// The cost of the merchandise line that the buyer will pay at checkout.
|
|
127
|
+
public var cost: AnglerCartLineCost?
|
|
128
|
+
/// Product variant of the line item.
|
|
129
|
+
public var merchandise: AnglerProductVariant?
|
|
130
|
+
/// The quantity of the merchandise that the customer intends to purchase.
|
|
131
|
+
public var quantity: Double?
|
|
132
|
+
|
|
133
|
+
public init(cost: AnglerCartLineCost? = nil, merchandise: AnglerProductVariant? = nil, quantity: Double? = nil) {
|
|
134
|
+
self.cost = cost
|
|
135
|
+
self.merchandise = merchandise
|
|
136
|
+
self.quantity = quantity
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// The cost of the merchandise line that the buyer will pay at checkout.
|
|
141
|
+
public struct AnglerCartLineCost: Encodable, Equatable {
|
|
142
|
+
/// A monetary value with currency.
|
|
143
|
+
public var totalAmount: AnglerMoney?
|
|
144
|
+
|
|
145
|
+
public init(totalAmount: AnglerMoney? = nil) {
|
|
146
|
+
self.totalAmount = totalAmount
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// Product variant of the line item.
|
|
151
|
+
public struct AnglerProductVariant: Encodable, Equatable {
|
|
152
|
+
/// A globally unique identifier.
|
|
153
|
+
public var id: String?
|
|
154
|
+
/// Image associated with the product variant. This field falls back to the product image if no image is available.
|
|
155
|
+
public var image: AnglerImage?
|
|
156
|
+
/// The inventory item associated with the product variant, including its per-item cost (COGS).
|
|
157
|
+
public var inventoryItem: AnglerInventoryItem?
|
|
158
|
+
/// A monetary value with currency.
|
|
159
|
+
public var price: AnglerMoney?
|
|
160
|
+
/// The product object that the product variant belongs to.
|
|
161
|
+
public var product: AnglerProduct?
|
|
162
|
+
/// The SKU (stock keeping unit) associated with the variant.
|
|
163
|
+
public var sku: String?
|
|
164
|
+
/// The product variant’s title.
|
|
165
|
+
public var title: String?
|
|
166
|
+
/// The product variant’s untranslated title.
|
|
167
|
+
public var untranslatedTitle: String?
|
|
168
|
+
|
|
169
|
+
public init(id: String? = nil, image: AnglerImage? = nil, inventoryItem: AnglerInventoryItem? = nil, price: AnglerMoney? = nil, product: AnglerProduct? = nil, sku: String? = nil, title: String? = nil, untranslatedTitle: String? = nil) {
|
|
170
|
+
self.id = id
|
|
171
|
+
self.image = image
|
|
172
|
+
self.inventoryItem = inventoryItem
|
|
173
|
+
self.price = price
|
|
174
|
+
self.product = product
|
|
175
|
+
self.sku = sku
|
|
176
|
+
self.title = title
|
|
177
|
+
self.untranslatedTitle = untranslatedTitle
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/// Image associated with the product variant. This field falls back to the product image if no image is available.
|
|
182
|
+
public struct AnglerImage: Encodable, Equatable {
|
|
183
|
+
/// The location of the image as a URL.
|
|
184
|
+
public var src: String?
|
|
185
|
+
|
|
186
|
+
public init(src: String? = nil) {
|
|
187
|
+
self.src = src
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/// The inventory item associated with the product variant, including its per-item cost (COGS).
|
|
192
|
+
public struct AnglerInventoryItem: Encodable, Equatable {
|
|
193
|
+
/// Inventory item identifier. Optional; for Shopify shops this is the inventory_items.id. For non-Shopify, may equal variant.id.
|
|
194
|
+
public var id: String?
|
|
195
|
+
/// A monetary value with currency representing the unit cost to manufacture, distribute, and sell the item.
|
|
196
|
+
public var cost: AnglerMoney?
|
|
197
|
+
|
|
198
|
+
public init(id: String? = nil, cost: AnglerMoney? = nil) {
|
|
199
|
+
self.id = id
|
|
200
|
+
self.cost = cost
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/// The product object that the product variant belongs to.
|
|
205
|
+
public struct AnglerProduct: Encodable, Equatable {
|
|
206
|
+
/// The ID of the product.
|
|
207
|
+
public var id: String?
|
|
208
|
+
/// The product’s title.
|
|
209
|
+
public var title: String?
|
|
210
|
+
/// The product’s untranslated title.
|
|
211
|
+
public var untranslatedTitle: String?
|
|
212
|
+
/// The product’s vendor name.
|
|
213
|
+
public var vendor: String?
|
|
214
|
+
/// The product type specified by the merchant.
|
|
215
|
+
public var type: String?
|
|
216
|
+
/// The relative URL of the product.
|
|
217
|
+
public var url: String?
|
|
218
|
+
|
|
219
|
+
public init(id: String? = nil, title: String? = nil, untranslatedTitle: String? = nil, vendor: String? = nil, type: String? = nil, url: String? = nil) {
|
|
220
|
+
self.id = id
|
|
221
|
+
self.title = title
|
|
222
|
+
self.untranslatedTitle = untranslatedTitle
|
|
223
|
+
self.vendor = vendor
|
|
224
|
+
self.type = type
|
|
225
|
+
self.url = url
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
public struct AnglerCheckout: Encodable, Equatable {
|
|
230
|
+
/// A list of attributes accumulated throughout the checkout process.
|
|
231
|
+
public var attributes: [AnglerAttribute]?
|
|
232
|
+
/// An address.
|
|
233
|
+
public var billingAddress: AnglerMailingAddress?
|
|
234
|
+
/// The three-letter code that represents the currency, for example, USD. Supported codes include standard ISO 4217 codes, legacy codes, and non-standard codes.
|
|
235
|
+
public var currencyCode: String?
|
|
236
|
+
/// A list of discount applications.
|
|
237
|
+
public var discountApplications: [AnglerDiscountApplication]?
|
|
238
|
+
/// The email attached to this checkout.
|
|
239
|
+
public var email: String?
|
|
240
|
+
/// Hashed value of email in SHA256 (lower case).
|
|
241
|
+
public var hashedEmail: String?
|
|
242
|
+
/// A list of line item objects, each one containing information about an item in the checkout.
|
|
243
|
+
public var lineItems: [AnglerCheckoutLineItem]?
|
|
244
|
+
public var order: AnglerOrder?
|
|
245
|
+
/// A unique phone number for the customer.
|
|
246
|
+
public var phone: String?
|
|
247
|
+
/// Hashed value of phone in SHA256 (lower case).
|
|
248
|
+
public var hashedPhone: String?
|
|
249
|
+
/// An address.
|
|
250
|
+
public var shippingAddress: AnglerMailingAddress?
|
|
251
|
+
public var shippingLine: AnglerShippingRate?
|
|
252
|
+
/// A monetary value with currency.
|
|
253
|
+
public var subtotalPrice: AnglerMoney?
|
|
254
|
+
/// A unique identifier for a particular checkout.
|
|
255
|
+
public var token: String?
|
|
256
|
+
/// A monetary value with currency.
|
|
257
|
+
public var totalPrice: AnglerMoney?
|
|
258
|
+
/// A monetary value with currency.
|
|
259
|
+
public var totalTax: AnglerMoney?
|
|
260
|
+
|
|
261
|
+
public init(attributes: [AnglerAttribute]? = nil, billingAddress: AnglerMailingAddress? = nil, currencyCode: String? = nil, discountApplications: [AnglerDiscountApplication]? = nil, email: String? = nil, hashedEmail: String? = nil, lineItems: [AnglerCheckoutLineItem]? = nil, order: AnglerOrder? = nil, phone: String? = nil, hashedPhone: String? = nil, shippingAddress: AnglerMailingAddress? = nil, shippingLine: AnglerShippingRate? = nil, subtotalPrice: AnglerMoney? = nil, token: String? = nil, totalPrice: AnglerMoney? = nil, totalTax: AnglerMoney? = nil) {
|
|
262
|
+
self.attributes = attributes
|
|
263
|
+
self.billingAddress = billingAddress
|
|
264
|
+
self.currencyCode = currencyCode
|
|
265
|
+
self.discountApplications = discountApplications
|
|
266
|
+
self.email = email
|
|
267
|
+
self.hashedEmail = hashedEmail
|
|
268
|
+
self.lineItems = lineItems
|
|
269
|
+
self.order = order
|
|
270
|
+
self.phone = phone
|
|
271
|
+
self.hashedPhone = hashedPhone
|
|
272
|
+
self.shippingAddress = shippingAddress
|
|
273
|
+
self.shippingLine = shippingLine
|
|
274
|
+
self.subtotalPrice = subtotalPrice
|
|
275
|
+
self.token = token
|
|
276
|
+
self.totalPrice = totalPrice
|
|
277
|
+
self.totalTax = totalTax
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
public struct AnglerAttribute: Encodable, Equatable {
|
|
282
|
+
public var key: String
|
|
283
|
+
public var value: String?
|
|
284
|
+
|
|
285
|
+
public init(key: String, value: String? = nil) {
|
|
286
|
+
self.key = key
|
|
287
|
+
self.value = value
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/// An address.
|
|
292
|
+
public struct AnglerMailingAddress: Encodable, Equatable {
|
|
293
|
+
/// The first line of the address. This is usually the street address or a P.O. Box number.
|
|
294
|
+
public var address1: String?
|
|
295
|
+
/// The second line of the address. This is usually an apartment, suite, or unit number.
|
|
296
|
+
public var address2: String?
|
|
297
|
+
/// The name of the city, district, village, or town.
|
|
298
|
+
public var city: String?
|
|
299
|
+
/// The name of the country.
|
|
300
|
+
public var country: String?
|
|
301
|
+
/// The two-letter code that represents the country, for example, US. The country codes generally follows ISO 3166-1 alpha-2 guidelines.
|
|
302
|
+
public var countryCode: String?
|
|
303
|
+
/// The customer’s first name.
|
|
304
|
+
public var firstName: String?
|
|
305
|
+
/// The customer’s last name.
|
|
306
|
+
public var lastName: String?
|
|
307
|
+
/// The phone number for this mailing address as entered by the customer.
|
|
308
|
+
public var phone: String?
|
|
309
|
+
/// The region of the address, such as the province, state, or district.
|
|
310
|
+
public var province: String?
|
|
311
|
+
/// The two-letter code for the region. For example, ON.
|
|
312
|
+
public var provinceCode: String?
|
|
313
|
+
/// The ZIP or postal code of the address.
|
|
314
|
+
public var zip: String?
|
|
315
|
+
/// Hashed value of phone in SHA256 (lower case).
|
|
316
|
+
public var hashedPhone: String?
|
|
317
|
+
/// Hashed value of first name in SHA256 (lower case).
|
|
318
|
+
public var hashedFirstName: String?
|
|
319
|
+
/// Hashed value of last name in SHA256 (lower case).
|
|
320
|
+
public var hashedLastName: String?
|
|
321
|
+
/// Hashed value of zip in SHA256 (lower case).
|
|
322
|
+
public var hashedZip: String?
|
|
323
|
+
|
|
324
|
+
public init(address1: String? = nil, address2: String? = nil, city: String? = nil, country: String? = nil, countryCode: String? = nil, firstName: String? = nil, lastName: String? = nil, phone: String? = nil, province: String? = nil, provinceCode: String? = nil, zip: String? = nil, hashedPhone: String? = nil, hashedFirstName: String? = nil, hashedLastName: String? = nil, hashedZip: String? = nil) {
|
|
325
|
+
self.address1 = address1
|
|
326
|
+
self.address2 = address2
|
|
327
|
+
self.city = city
|
|
328
|
+
self.country = country
|
|
329
|
+
self.countryCode = countryCode
|
|
330
|
+
self.firstName = firstName
|
|
331
|
+
self.lastName = lastName
|
|
332
|
+
self.phone = phone
|
|
333
|
+
self.province = province
|
|
334
|
+
self.provinceCode = provinceCode
|
|
335
|
+
self.zip = zip
|
|
336
|
+
self.hashedPhone = hashedPhone
|
|
337
|
+
self.hashedFirstName = hashedFirstName
|
|
338
|
+
self.hashedLastName = hashedLastName
|
|
339
|
+
self.hashedZip = hashedZip
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/// Discount applications capture the intentions of a discount source at the time of application.
|
|
344
|
+
public struct AnglerDiscountApplication: Encodable, Equatable {
|
|
345
|
+
/// The method by which the discount's value is applied to its entitled items.
|
|
346
|
+
public var allocationMethod: String?
|
|
347
|
+
/// How the discount amount is distributed on the discounted lines.
|
|
348
|
+
public var targetSelection: String?
|
|
349
|
+
/// The type of line (i.e. line item or shipping line) on an order that the discount is applicable towards.
|
|
350
|
+
public var targetType: String?
|
|
351
|
+
/// The customer-facing name of the discount. If the type of discount is a DISCOUNT_CODE, this title attribute represents the code of the discount.
|
|
352
|
+
public var title: String?
|
|
353
|
+
/// The type of the discount.
|
|
354
|
+
public var type: String?
|
|
355
|
+
/// The value of the discount.
|
|
356
|
+
public var value: AnglerDiscountApplicationValue?
|
|
357
|
+
|
|
358
|
+
public init(allocationMethod: String? = nil, targetSelection: String? = nil, targetType: String? = nil, title: String? = nil, type: String? = nil, value: AnglerDiscountApplicationValue? = nil) {
|
|
359
|
+
self.allocationMethod = allocationMethod
|
|
360
|
+
self.targetSelection = targetSelection
|
|
361
|
+
self.targetType = targetType
|
|
362
|
+
self.title = title
|
|
363
|
+
self.type = type
|
|
364
|
+
self.value = value
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/// The value of the percentage pricing object.
|
|
369
|
+
public struct AnglerPricingPercentageValue: Encodable, Equatable {
|
|
370
|
+
/// The percentage value of the object.
|
|
371
|
+
public var percentage: Double?
|
|
372
|
+
|
|
373
|
+
public init(percentage: Double? = nil) {
|
|
374
|
+
self.percentage = percentage
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/// A list of line item objects, each one containing information about an item in the checkout.
|
|
379
|
+
public struct AnglerCheckoutLineItem: Encodable, Equatable {
|
|
380
|
+
/// The discounts that have been applied to the checkout line item by a discount application.
|
|
381
|
+
public var discountAllocations: [AnglerDiscountAllocation]?
|
|
382
|
+
/// A globally unique identifier.
|
|
383
|
+
public var id: String?
|
|
384
|
+
/// The quantity of the line item.
|
|
385
|
+
public var quantity: Double?
|
|
386
|
+
/// The selling plan associated with the line item and the effect that each selling plan has on variants when they're purchased.
|
|
387
|
+
public var sellingPlanAllocation: AnglerSellingPlanAllocation?
|
|
388
|
+
/// The title of the line item. Defaults to the product's title.
|
|
389
|
+
public var title: String?
|
|
390
|
+
/// Product variant of the line item.
|
|
391
|
+
public var variant: AnglerProductVariant?
|
|
392
|
+
|
|
393
|
+
public init(discountAllocations: [AnglerDiscountAllocation]? = nil, id: String? = nil, quantity: Double? = nil, sellingPlanAllocation: AnglerSellingPlanAllocation? = nil, title: String? = nil, variant: AnglerProductVariant? = nil) {
|
|
394
|
+
self.discountAllocations = discountAllocations
|
|
395
|
+
self.id = id
|
|
396
|
+
self.quantity = quantity
|
|
397
|
+
self.sellingPlanAllocation = sellingPlanAllocation
|
|
398
|
+
self.title = title
|
|
399
|
+
self.variant = variant
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/// An amount discounting the line that has been allocated by a discount.
|
|
404
|
+
public struct AnglerDiscountAllocation: Encodable, Equatable {
|
|
405
|
+
/// A monetary value with currency.
|
|
406
|
+
public var amount: AnglerMoney?
|
|
407
|
+
/// Discount applications capture the intentions of a discount source at the time of application.
|
|
408
|
+
public var discountApplication: AnglerDiscountApplication?
|
|
409
|
+
|
|
410
|
+
public init(amount: AnglerMoney? = nil, discountApplication: AnglerDiscountApplication? = nil) {
|
|
411
|
+
self.amount = amount
|
|
412
|
+
self.discountApplication = discountApplication
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/// The selling plan associated with the line item and the effect that each selling plan has on variants when they're purchased.
|
|
417
|
+
public struct AnglerSellingPlanAllocation: Encodable, Equatable {
|
|
418
|
+
/// A representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'.
|
|
419
|
+
public var sellingPlan: AnglerSellingPlan?
|
|
420
|
+
|
|
421
|
+
public init(sellingPlan: AnglerSellingPlan? = nil) {
|
|
422
|
+
self.sellingPlan = sellingPlan
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/// A representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'.
|
|
427
|
+
public struct AnglerSellingPlan: Encodable, Equatable {
|
|
428
|
+
/// A globally unique identifier.
|
|
429
|
+
public var id: String?
|
|
430
|
+
/// The name of the selling plan. For example, '6 weeks of prepaid granola, delivered weekly'.
|
|
431
|
+
public var name: String?
|
|
432
|
+
|
|
433
|
+
public init(id: String? = nil, name: String? = nil) {
|
|
434
|
+
self.id = id
|
|
435
|
+
self.name = name
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
public struct AnglerOrder: Encodable, Equatable {
|
|
440
|
+
/// The ID of the order.
|
|
441
|
+
public var id: String?
|
|
442
|
+
|
|
443
|
+
public init(id: String? = nil) {
|
|
444
|
+
self.id = id
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
public struct AnglerShippingRate: Encodable, Equatable {
|
|
449
|
+
/// A monetary value with currency.
|
|
450
|
+
public var price: AnglerMoney?
|
|
451
|
+
|
|
452
|
+
public init(price: AnglerMoney? = nil) {
|
|
453
|
+
self.price = price
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
public struct AnglerCollection: Encodable, Equatable {
|
|
458
|
+
/// A globally unique identifier.
|
|
459
|
+
public var id: String?
|
|
460
|
+
/// The collection’s name.
|
|
461
|
+
public var title: String?
|
|
462
|
+
public var productVariants: [AnglerProductVariant]?
|
|
463
|
+
|
|
464
|
+
public init(id: String? = nil, title: String? = nil, productVariants: [AnglerProductVariant]? = nil) {
|
|
465
|
+
self.id = id
|
|
466
|
+
self.title = title
|
|
467
|
+
self.productVariants = productVariants
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
public struct AnglerSearchResult: Encodable, Equatable {
|
|
472
|
+
/// The search query that was executed.
|
|
473
|
+
public var query: String?
|
|
474
|
+
public var productVariants: [AnglerProductVariant]?
|
|
475
|
+
|
|
476
|
+
public init(query: String? = nil, productVariants: [AnglerProductVariant]? = nil) {
|
|
477
|
+
self.query = query
|
|
478
|
+
self.productVariants = productVariants
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
public struct AnglerCustomer: Encodable, Equatable {
|
|
483
|
+
/// A unique identifier for the customer.
|
|
484
|
+
public var id: String?
|
|
485
|
+
/// The customer's email address.
|
|
486
|
+
public var email: String?
|
|
487
|
+
/// The customer's first name.
|
|
488
|
+
public var firstName: String?
|
|
489
|
+
/// The customer's last name.
|
|
490
|
+
public var lastName: String?
|
|
491
|
+
/// The number of orders associated with this customer.
|
|
492
|
+
public var ordersCount: Double?
|
|
493
|
+
/// The unique phone number (E.164 format) for this customer.
|
|
494
|
+
public var phone: String?
|
|
495
|
+
/// The customer's date of birth.
|
|
496
|
+
public var dob: String?
|
|
497
|
+
/// Hashed value of email in SHA256 (lower case).
|
|
498
|
+
public var hashedEmail: String?
|
|
499
|
+
/// Hashed value of phone in SHA256 (lower case).
|
|
500
|
+
public var hashedPhone: String?
|
|
501
|
+
/// Hashed value of first name in SHA256 (lower case).
|
|
502
|
+
public var hashedFirstName: String?
|
|
503
|
+
/// Hashed value of last name in SHA256 (lower case).
|
|
504
|
+
public var hashedLastName: String?
|
|
505
|
+
/// Hashed value of date of birth in SHA256 (lower case).
|
|
506
|
+
public var hashedDob: String?
|
|
507
|
+
|
|
508
|
+
public init(id: String? = nil, email: String? = nil, firstName: String? = nil, lastName: String? = nil, ordersCount: Double? = nil, phone: String? = nil, dob: String? = nil, hashedEmail: String? = nil, hashedPhone: String? = nil, hashedFirstName: String? = nil, hashedLastName: String? = nil, hashedDob: String? = nil) {
|
|
509
|
+
self.id = id
|
|
510
|
+
self.email = email
|
|
511
|
+
self.firstName = firstName
|
|
512
|
+
self.lastName = lastName
|
|
513
|
+
self.ordersCount = ordersCount
|
|
514
|
+
self.phone = phone
|
|
515
|
+
self.dob = dob
|
|
516
|
+
self.hashedEmail = hashedEmail
|
|
517
|
+
self.hashedPhone = hashedPhone
|
|
518
|
+
self.hashedFirstName = hashedFirstName
|
|
519
|
+
self.hashedLastName = hashedLastName
|
|
520
|
+
self.hashedDob = hashedDob
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
public struct AnglerFormElement: Encodable, Equatable {
|
|
525
|
+
/// The id attribute of an element.
|
|
526
|
+
public var id: String?
|
|
527
|
+
/// The action attribute of a form element.
|
|
528
|
+
public var action: String?
|
|
529
|
+
public var elements: [AnglerInputElement]?
|
|
530
|
+
|
|
531
|
+
public init(id: String? = nil, action: String? = nil, elements: [AnglerInputElement]? = nil) {
|
|
532
|
+
self.id = id
|
|
533
|
+
self.action = action
|
|
534
|
+
self.elements = elements
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
public struct AnglerInputElement: Encodable, Equatable {
|
|
539
|
+
/// The id attribute of an element.
|
|
540
|
+
public var id: String?
|
|
541
|
+
/// The name attribute of an element.
|
|
542
|
+
public var name: String?
|
|
543
|
+
/// A string representation of the tag of an element.
|
|
544
|
+
public var tagName: String?
|
|
545
|
+
/// The type attribute of an element. Often relevant for an input or button element.
|
|
546
|
+
public var type: String?
|
|
547
|
+
/// The value attribute of an element. Often relevant for an input element.
|
|
548
|
+
public var value: String?
|
|
549
|
+
|
|
550
|
+
public init(id: String? = nil, name: String? = nil, tagName: String? = nil, type: String? = nil, value: String? = nil) {
|
|
551
|
+
self.id = id
|
|
552
|
+
self.name = name
|
|
553
|
+
self.tagName = tagName
|
|
554
|
+
self.type = type
|
|
555
|
+
self.value = value
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
public struct AnglerCustomValue: Encodable, Equatable {
|
|
560
|
+
public var name: String
|
|
561
|
+
public var value: String
|
|
562
|
+
|
|
563
|
+
public init(name: String, value: String) {
|
|
564
|
+
self.name = name
|
|
565
|
+
self.value = value
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/// One of: AnglerMoney, AnglerPricingPercentageValue.
|
|
570
|
+
public enum AnglerDiscountApplicationValue: Encodable, Equatable {
|
|
571
|
+
case money(AnglerMoney)
|
|
572
|
+
case pricingPercentageValue(AnglerPricingPercentageValue)
|
|
573
|
+
|
|
574
|
+
public func encode(to encoder: Encoder) throws {
|
|
575
|
+
switch self {
|
|
576
|
+
case .money(let value): try value.encode(to: encoder)
|
|
577
|
+
case .pricingPercentageValue(let value): try value.encode(to: encoder)
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|