@tfcorp/consumer-app-react-native-sdk 2.0.4 → 2.0.6
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/README.md +68 -6
- package/android/src/main/java/com/truefit/reactnative/TrueFitOrderModule.kt +62 -0
- package/android/src/main/java/com/truefit/reactnative/TrueFitRecommendationPackage.kt +2 -1
- package/android/src/main/java/com/truefit/reactnative/TrueFitRecommendationProps.kt +34 -3
- package/ios/TrueFitBridgeValues.swift +25 -0
- package/ios/TrueFitOrderModule.m +7 -0
- package/ios/TrueFitOrderModule.swift +66 -0
- package/ios/TrueFitRecommendationView.swift +7 -27
- package/lib/commonjs/index.js +30 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +29 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +29 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,8 @@ presents the size modal full screen on its own. It uses the official True Fit
|
|
|
8
8
|
materializes the account sign-in popup (`window.open`) so shoppers can register
|
|
9
9
|
and get a personalized recommendation.
|
|
10
10
|
|
|
11
|
-
This package exposes a
|
|
11
|
+
This package exposes a native view for the widget and a `trackOrder` function
|
|
12
|
+
for order confirmation reporting:
|
|
12
13
|
|
|
13
14
|
```tsx
|
|
14
15
|
import {
|
|
@@ -86,6 +87,65 @@ clipped by the webview.
|
|
|
86
87
|
profile-based recommendation, `'general'` for a generic one, and `null` when
|
|
87
88
|
there is none.
|
|
88
89
|
|
|
90
|
+
## Order tracking
|
|
91
|
+
|
|
92
|
+
`trackOrder` reports a completed order from the order confirmation screen. It
|
|
93
|
+
forwards to the native order API on each platform (`TrueFitApi.trackOrder` on
|
|
94
|
+
Android, `TFOrderAPI.trackOrder` on iOS), which posts in the background and
|
|
95
|
+
never reports delivery back — there is nothing to await.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { trackOrder, type TFTrackOrderProduct } from 'consumer-app-react-native-sdk';
|
|
99
|
+
|
|
100
|
+
const products: TFTrackOrderProduct[] = [
|
|
101
|
+
{
|
|
102
|
+
productId: '7093242789933',
|
|
103
|
+
quantity: 1,
|
|
104
|
+
price: 89.0,
|
|
105
|
+
currency: 'USD',
|
|
106
|
+
colorId: 'Black',
|
|
107
|
+
size: 'M',
|
|
108
|
+
sku: '7093242789933-BLK-M',
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
trackOrder({
|
|
113
|
+
storeKey: 'nda',
|
|
114
|
+
orderId: 'order-123',
|
|
115
|
+
products,
|
|
116
|
+
environment: 'prod',
|
|
117
|
+
locale: 'en_US',
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### `trackOrder(args)`
|
|
122
|
+
|
|
123
|
+
| Name | Type | Default |
|
|
124
|
+
| ------------- | ------------------------- | ---------------------------------------------- |
|
|
125
|
+
| `storeKey` | `string` | Required |
|
|
126
|
+
| `orderId` | `string` | Required |
|
|
127
|
+
| `products` | `TFTrackOrderProduct[]` | Required |
|
|
128
|
+
| `environment` | `'development' \| 'prod'` | `'prod'` — pass the same value the widget uses |
|
|
129
|
+
| `locale` | `string` | Not set |
|
|
130
|
+
|
|
131
|
+
### `TFTrackOrderProduct`
|
|
132
|
+
|
|
133
|
+
| Name | Type | Notes |
|
|
134
|
+
| ----------- | -------- | ------------------------------------------------------------------- |
|
|
135
|
+
| `productId` | `string` | Required. Must match the ProductID in the Product Catalog feed |
|
|
136
|
+
| `quantity` | `number` | Required |
|
|
137
|
+
| `price` | `number` | Required. Unit price paid — the final price if the item was on sale |
|
|
138
|
+
| `currency` | `string` | Required |
|
|
139
|
+
| `colorId` | `string` | Optional, required for reporting |
|
|
140
|
+
| `size` | `string` | Optional, required for reporting |
|
|
141
|
+
| `sku` | `string` | Optional, required for reporting |
|
|
142
|
+
|
|
143
|
+
The native SDKs drop line items with a blank `productId` and skip the order
|
|
144
|
+
when all supplied products have blank IDs. The adapters skip calls with malformed
|
|
145
|
+
product arrays or missing, nonnumeric, or nonfinite quantities/prices.
|
|
146
|
+
`trackOrder` throws if the native module is
|
|
147
|
+
not linked, which means the app was not rebuilt after installing the package.
|
|
148
|
+
|
|
89
149
|
## Sign-in popup
|
|
90
150
|
|
|
91
151
|
The widget's account sign-in opens the Keycloak login page via `window.open`.
|
|
@@ -103,13 +163,15 @@ the standalone True Fit native SDKs, which this package depends on:
|
|
|
103
163
|
```text
|
|
104
164
|
React Native SDK (consumer-app-react-native-sdk)
|
|
105
165
|
├── TypeScript public API (src/index.tsx)
|
|
106
|
-
├── Android adapter (ViewManager +
|
|
107
|
-
└── iOS adapter (RCTViewManager +
|
|
166
|
+
├── Android adapter (ViewManager + order module + mappers) → depends on truefit-android-sdk
|
|
167
|
+
└── iOS adapter (RCTViewManager + order module + mappers) → depends on TrueFitRecommendation pod
|
|
108
168
|
```
|
|
109
169
|
|
|
110
|
-
The adapters only map props to native
|
|
111
|
-
events, and integrate the native view into React Native
|
|
112
|
-
widget behaviour matches the standalone native SDK
|
|
170
|
+
The adapters only map props and arguments to native types, forward native
|
|
171
|
+
callbacks to JS events, and integrate the native view into React Native
|
|
172
|
+
layout/lifecycle, so the widget behaviour matches the standalone native SDK
|
|
173
|
+
sample apps exactly. Order tracking contains no transport of its own; it calls
|
|
174
|
+
the native SDKs' order API directly.
|
|
113
175
|
|
|
114
176
|
## Native SDK dependencies
|
|
115
177
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
package com.truefit.reactnative
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
import com.facebook.react.bridge.ReadableMap
|
|
8
|
+
import com.facebook.react.bridge.ReadableType
|
|
9
|
+
import com.truefit.recommendation.TrueFitApi
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Bridges the standalone Android SDK's order tracking to JS. The SDK owns
|
|
13
|
+
* transport, validation, threading and logging; this module only maps the JS
|
|
14
|
+
* arguments onto it. Like the SDK call it is fire-and-forget: it never throws
|
|
15
|
+
* and never reports delivery back to JS.
|
|
16
|
+
*/
|
|
17
|
+
class TrueFitOrderModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
18
|
+
|
|
19
|
+
override fun getName() = NAME
|
|
20
|
+
|
|
21
|
+
@ReactMethod
|
|
22
|
+
fun trackOrder(arguments: ReadableMap) {
|
|
23
|
+
val storeKey = arguments.nonBlankString("storeKey")
|
|
24
|
+
if (storeKey == null) {
|
|
25
|
+
Log.w(NAME, "trackOrder skipped: storeKey is required")
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
val orderId = arguments.nonBlankString("orderId")
|
|
30
|
+
if (orderId == null) {
|
|
31
|
+
Log.w(NAME, "trackOrder skipped: orderId is required")
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!arguments.hasKey("products") || arguments.getType("products") != ReadableType.Array) {
|
|
36
|
+
Log.w(NAME, "trackOrder skipped: products must be an array")
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
val productArguments = arguments.getArray("products") ?: return
|
|
40
|
+
val products = TrueFitRecommendationProps.trackOrderProducts(productArguments)
|
|
41
|
+
if (products == null) {
|
|
42
|
+
Log.w(NAME, "trackOrder skipped: malformed products")
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
TrueFitApi.trackOrder(
|
|
47
|
+
storeKey = storeKey,
|
|
48
|
+
orderId = orderId,
|
|
49
|
+
products = products,
|
|
50
|
+
environment = TrueFitRecommendationProps.environment(
|
|
51
|
+
arguments.nonBlankString("environment"),
|
|
52
|
+
),
|
|
53
|
+
locale = arguments.nonBlankString("locale"),
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
companion object {
|
|
58
|
+
const val NAME = "TrueFitOrderModule"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private fun ReadableMap.nonBlankString(name: String): String? = stringOrNull(name)?.takeIf { it.isNotBlank() }
|
|
@@ -6,7 +6,8 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
7
|
|
|
8
8
|
class TrueFitRecommendationPackage : ReactPackage {
|
|
9
|
-
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
|
|
9
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
|
|
10
|
+
listOf(TrueFitOrderModule(reactContext))
|
|
10
11
|
|
|
11
12
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
|
|
12
13
|
listOf(TrueFitRecommendationViewManager())
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
package com.truefit.reactnative
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.bridge.ReadableArray
|
|
3
4
|
import com.facebook.react.bridge.ReadableMap
|
|
4
5
|
import com.facebook.react.bridge.ReadableType
|
|
6
|
+
import com.truefit.recommendation.TFTrackOrderProduct
|
|
5
7
|
import com.truefit.recommendation.TrueFitEnvironment
|
|
6
8
|
import com.truefit.recommendation.TrueFitRecommendationConfig
|
|
7
9
|
import com.truefit.recommendation.TrueFitRecommendationOptions
|
|
@@ -28,7 +30,7 @@ object TrueFitRecommendationProps {
|
|
|
28
30
|
return TrueFitRecommendationConfig(
|
|
29
31
|
storeKey = storeKey,
|
|
30
32
|
storeStyle = storeStyle,
|
|
31
|
-
environment =
|
|
33
|
+
environment = environment(map.stringOrNull("environment")),
|
|
32
34
|
uiLocale = map.stringOrNull("uiLocale")?.takeIf { it.isNotBlank() },
|
|
33
35
|
userToken = map.stringOrNull("userToken")?.takeIf { it.isNotBlank() },
|
|
34
36
|
// A full script URL overrides `environment` (e.g. a built bundle).
|
|
@@ -61,14 +63,38 @@ object TrueFitRecommendationProps {
|
|
|
61
63
|
)
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
fun trackOrderProducts(array: ReadableArray): List<TFTrackOrderProduct>? {
|
|
67
|
+
return (0 until array.size()).map { index ->
|
|
68
|
+
if (array.getType(index) != ReadableType.Map) return null
|
|
69
|
+
val product = array.getMap(index) ?: return null
|
|
70
|
+
val productId = product.stringOrNull("productId").orEmpty()
|
|
71
|
+
val quantity = product.orderNumberOrNull("quantity") ?: return null
|
|
72
|
+
val price = product.orderNumberOrNull("price") ?: return null
|
|
73
|
+
|
|
74
|
+
TFTrackOrderProduct(
|
|
75
|
+
productId = productId,
|
|
76
|
+
quantity = quantity.toInt(),
|
|
77
|
+
price = price,
|
|
78
|
+
currency = product.stringOrNull("currency").orEmpty(),
|
|
79
|
+
colorId = product.stringOrNull("colorId")?.takeIf { it.isNotBlank() },
|
|
80
|
+
size = product.stringOrNull("size")?.takeIf { it.isNotBlank() },
|
|
81
|
+
sku = product.stringOrNull("sku")?.takeIf { it.isNotBlank() },
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
fun environment(name: String?): TrueFitEnvironment = when (name?.lowercase()) {
|
|
65
87
|
"development", "dev" -> TrueFitEnvironment.Development
|
|
66
88
|
"prod", "production" -> TrueFitEnvironment.Prod
|
|
67
89
|
else -> TrueFitEnvironment.Prod
|
|
68
90
|
}
|
|
69
91
|
}
|
|
70
92
|
|
|
71
|
-
|
|
93
|
+
/**
|
|
94
|
+
* JS numbers reach the bridge as `Number`, so read them as strings too rather
|
|
95
|
+
* than letting `getString` throw on a numeric storeKey/productId.
|
|
96
|
+
*/
|
|
97
|
+
internal fun ReadableMap.stringOrNull(name: String): String? {
|
|
72
98
|
if (!hasKey(name) || isNull(name)) return null
|
|
73
99
|
|
|
74
100
|
return when (getType(name)) {
|
|
@@ -88,6 +114,11 @@ private fun ReadableMap.intOrDefault(name: String, defaultValue: Int): Int =
|
|
|
88
114
|
private fun ReadableMap.longOrDefault(name: String, defaultValue: Long): Long =
|
|
89
115
|
if (hasKey(name) && !isNull(name)) getDouble(name).toLong() else defaultValue
|
|
90
116
|
|
|
117
|
+
private fun ReadableMap.orderNumberOrNull(name: String): Double? {
|
|
118
|
+
if (!hasKey(name) || getType(name) != ReadableType.Number) return null
|
|
119
|
+
return getDouble(name).takeIf { it.isFinite() }
|
|
120
|
+
}
|
|
121
|
+
|
|
91
122
|
private fun ReadableMap.floatOrDefault(name: String, defaultValue: Float): Float =
|
|
92
123
|
if (hasKey(name) && !isNull(name)) getDouble(name).toFloat() else defaultValue
|
|
93
124
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import TrueFitRecommendation
|
|
3
|
+
|
|
4
|
+
enum TrueFitBridgeValues {
|
|
5
|
+
static func environment(_ name: String) -> TrueFitEnvironment {
|
|
6
|
+
switch name.lowercased() {
|
|
7
|
+
case "development", "dev":
|
|
8
|
+
.development
|
|
9
|
+
case "prod", "production":
|
|
10
|
+
.prod
|
|
11
|
+
default:
|
|
12
|
+
.prod
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static func string(_ value: Any?) -> String? {
|
|
17
|
+
if let string = value as? String { return string }
|
|
18
|
+
if let number = value as? NSNumber { return number.stringValue }
|
|
19
|
+
return nil
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
extension String {
|
|
24
|
+
var nonEmpty: String? { isEmpty ? nil : self }
|
|
25
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import CoreFoundation
|
|
2
|
+
import React
|
|
3
|
+
import TrueFitRecommendation
|
|
4
|
+
|
|
5
|
+
// Thin React Native adapter over the standalone iOS SDK's order tracking
|
|
6
|
+
// (`TFOrderAPI`). The SDK owns transport, validation and threading; this module
|
|
7
|
+
// only maps the JS arguments onto it. Like the SDK call it is fire-and-forget:
|
|
8
|
+
// it never throws and never reports delivery back to JS.
|
|
9
|
+
@objc(TrueFitOrderModule)
|
|
10
|
+
final class TrueFitOrderModule: NSObject {
|
|
11
|
+
// No UI is touched, so the module does not need main-queue setup.
|
|
12
|
+
@objc static func requiresMainQueueSetup() -> Bool {
|
|
13
|
+
false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@objc func trackOrder(_ arguments: NSDictionary) {
|
|
17
|
+
guard let storeKey = TrueFitBridgeValues.string(arguments["storeKey"])?.nonEmpty else {
|
|
18
|
+
NSLog("[TrueFit:OrderModule] trackOrder skipped: storeKey is required")
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
guard let orderId = TrueFitBridgeValues.string(arguments["orderId"])?.nonEmpty else {
|
|
22
|
+
NSLog("[TrueFit:OrderModule] trackOrder skipped: orderId is required")
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
guard let products = Self.products(from: arguments["products"]) else {
|
|
27
|
+
NSLog("[TrueFit:OrderModule] trackOrder skipped: malformed products")
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
TFOrderAPI().trackOrder(
|
|
32
|
+
storeKey: storeKey,
|
|
33
|
+
environment: TrueFitBridgeValues.string(arguments["environment"])
|
|
34
|
+
.map(TrueFitBridgeValues.environment) ?? .prod,
|
|
35
|
+
locale: TrueFitBridgeValues.string(arguments["locale"])?.nonEmpty,
|
|
36
|
+
orderID: orderId,
|
|
37
|
+
products: products
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// MARK: - Argument mapping
|
|
42
|
+
|
|
43
|
+
private static func products(from value: Any?) -> [TFTrackOrderProduct]? {
|
|
44
|
+
guard let entries = value as? [NSDictionary] else { return nil }
|
|
45
|
+
var products: [TFTrackOrderProduct] = []
|
|
46
|
+
for entry in entries {
|
|
47
|
+
guard let quantity = entry["quantity"] as? NSNumber,
|
|
48
|
+
let price = entry["price"] as? NSNumber,
|
|
49
|
+
CFGetTypeID(quantity) != CFBooleanGetTypeID(),
|
|
50
|
+
CFGetTypeID(price) != CFBooleanGetTypeID(),
|
|
51
|
+
quantity.doubleValue.isFinite, price.doubleValue.isFinite
|
|
52
|
+
else { return nil }
|
|
53
|
+
|
|
54
|
+
products.append(TFTrackOrderProduct(
|
|
55
|
+
productId: TrueFitBridgeValues.string(entry["productId"]) ?? "",
|
|
56
|
+
quantity: quantity.intValue,
|
|
57
|
+
price: price.doubleValue,
|
|
58
|
+
currency: TrueFitBridgeValues.string(entry["currency"]) ?? "",
|
|
59
|
+
colorId: TrueFitBridgeValues.string(entry["colorId"])?.nonEmpty,
|
|
60
|
+
size: TrueFitBridgeValues.string(entry["size"])?.nonEmpty,
|
|
61
|
+
sku: TrueFitBridgeValues.string(entry["sku"])?.nonEmpty
|
|
62
|
+
))
|
|
63
|
+
}
|
|
64
|
+
return products
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -111,18 +111,19 @@ final class TrueFitReactNativeView: UIView {
|
|
|
111
111
|
// MARK: - Prop mapping
|
|
112
112
|
|
|
113
113
|
private static func config(from dictionary: NSDictionary) -> TrueFitRecommendationConfig? {
|
|
114
|
-
guard let storeKey = string(dictionary["storeKey"]), !storeKey.isEmpty,
|
|
115
|
-
let storeStyle = string(dictionary["storeStyle"]), !storeStyle.isEmpty
|
|
114
|
+
guard let storeKey = TrueFitBridgeValues.string(dictionary["storeKey"]), !storeKey.isEmpty,
|
|
115
|
+
let storeStyle = TrueFitBridgeValues.string(dictionary["storeStyle"]), !storeStyle.isEmpty
|
|
116
116
|
else {
|
|
117
117
|
return nil
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
let environment = string(dictionary["environment"])
|
|
121
|
-
|
|
122
|
-
let
|
|
120
|
+
let environment = TrueFitBridgeValues.string(dictionary["environment"])
|
|
121
|
+
.map(TrueFitBridgeValues.environment) ?? .prod
|
|
122
|
+
let uiLocale = TrueFitBridgeValues.string(dictionary["uiLocale"])?.nonEmpty
|
|
123
|
+
let userToken = TrueFitBridgeValues.string(dictionary["userToken"])?.nonEmpty
|
|
123
124
|
// A full script URL overrides `environment` (e.g. a built bundle). Raw
|
|
124
125
|
// Vite dev entries (.ts) are not supported by the SDK.
|
|
125
|
-
let scriptUrlOverride = string(dictionary["scriptUrl"])?.nonEmpty
|
|
126
|
+
let scriptUrlOverride = TrueFitBridgeValues.string(dictionary["scriptUrl"])?.nonEmpty
|
|
126
127
|
|
|
127
128
|
return TrueFitRecommendationConfig(
|
|
128
129
|
storeKey: storeKey,
|
|
@@ -134,17 +135,6 @@ final class TrueFitReactNativeView: UIView {
|
|
|
134
135
|
)
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
private static func mapEnvironment(_ name: String) -> TrueFitEnvironment {
|
|
138
|
-
switch name.lowercased() {
|
|
139
|
-
case "development", "dev":
|
|
140
|
-
.development
|
|
141
|
-
case "prod", "production":
|
|
142
|
-
.prod
|
|
143
|
-
default:
|
|
144
|
-
.prod
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
138
|
private static func options(from dictionary: NSDictionary?) -> TrueFitRecommendationOptions {
|
|
149
139
|
var options = TrueFitRecommendationOptions()
|
|
150
140
|
guard let dictionary else { return options }
|
|
@@ -173,14 +163,4 @@ final class TrueFitReactNativeView: UIView {
|
|
|
173
163
|
|
|
174
164
|
return options
|
|
175
165
|
}
|
|
176
|
-
|
|
177
|
-
private static func string(_ value: Any?) -> String? {
|
|
178
|
-
if let string = value as? String { return string }
|
|
179
|
-
if let number = value as? NSNumber { return number.stringValue }
|
|
180
|
-
return nil
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
private extension String {
|
|
185
|
-
var nonEmpty: String? { isEmpty ? nil : self }
|
|
186
166
|
}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TrueFitRecommendationView = TrueFitRecommendationView;
|
|
7
|
-
exports.default = void 0;
|
|
7
|
+
exports.trackOrder = exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -20,6 +20,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
20
20
|
* recommendation, `'general'` for a generic one, and `null` when there is none.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
+
/** One line item in a completed order, reported through {@link trackOrder}. */
|
|
24
|
+
|
|
23
25
|
const NativeTrueFitRecommendationView = (0, _reactNative.requireNativeComponent)('TrueFitRecommendationView');
|
|
24
26
|
const DEFAULT_MIN_HEIGHT = 86;
|
|
25
27
|
function TrueFitRecommendationView({
|
|
@@ -81,5 +83,32 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
81
83
|
height: '100%'
|
|
82
84
|
}
|
|
83
85
|
});
|
|
86
|
+
const orderModule = _reactNative.NativeModules.TrueFitOrderModule;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Reports a completed order to True Fit, for the order confirmation screen.
|
|
90
|
+
* Forwards straight to the native SDKs' order API, which posts in the
|
|
91
|
+
* background and never reports delivery back — so there is nothing to await.
|
|
92
|
+
*/
|
|
93
|
+
const trackOrder = args => {
|
|
94
|
+
const {
|
|
95
|
+
storeKey,
|
|
96
|
+
orderId,
|
|
97
|
+
products,
|
|
98
|
+
environment = 'prod',
|
|
99
|
+
locale
|
|
100
|
+
} = args;
|
|
101
|
+
if (!orderModule) {
|
|
102
|
+
throw new Error("True Fit order tracking is unavailable because the native module is not linked. Rebuild the app after installing 'consumer-app-react-native-sdk' (on iOS, run pod install first).");
|
|
103
|
+
}
|
|
104
|
+
orderModule.trackOrder({
|
|
105
|
+
storeKey,
|
|
106
|
+
orderId,
|
|
107
|
+
products,
|
|
108
|
+
environment,
|
|
109
|
+
locale
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
exports.trackOrder = trackOrder;
|
|
84
113
|
var _default = exports.default = TrueFitRecommendationView;
|
|
85
114
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NativeTrueFitRecommendationView","requireNativeComponent","DEFAULT_MIN_HEIGHT","TrueFitRecommendationView","config","options","style","onPresentationModeChange","onHeightChange","onWidgetResult","onAutoSizeSelect","minHeight","minWidgetHeight","measuredHeight","setMeasuredHeight","useState","presentationMode","setPresentationMode","handleHeightChange","useCallback","event","nextHeight","Math","max","nativeEvent","height","handlePresentationModeChange","nextMode","mode","styleId","handleWidgetResult","handleAutoSizeSelect","containerStyle","useMemo","styles","container","zIndex","undefined","elevation","jsx","View","collapsable","children","nativeView","StyleSheet","create","width","overflow","position","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NativeTrueFitRecommendationView","requireNativeComponent","DEFAULT_MIN_HEIGHT","TrueFitRecommendationView","config","options","style","onPresentationModeChange","onHeightChange","onWidgetResult","onAutoSizeSelect","minHeight","minWidgetHeight","measuredHeight","setMeasuredHeight","useState","presentationMode","setPresentationMode","handleHeightChange","useCallback","event","nextHeight","Math","max","nativeEvent","height","handlePresentationModeChange","nextMode","mode","styleId","handleWidgetResult","handleAutoSizeSelect","containerStyle","useMemo","styles","container","zIndex","undefined","elevation","jsx","View","collapsable","children","nativeView","StyleSheet","create","width","overflow","position","orderModule","NativeModules","TrueFitOrderModule","trackOrder","args","storeKey","orderId","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AAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,WAAW,GAAG,MAAM;IAAEC;EAAO,CAAC,GAAGL,IAAI;EAE1E,IAAI,CAACJ,WAAW,EAAE;IAChB,MAAM,IAAIU,KAAK,CACb,mLACF,CAAC;EACH;EAEAV,WAAW,CAACG,UAAU,CAAC;IAAEE,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,WAAW;IAAEC;EAAO,CAAC,CAAC;AAC9E,CAAC;AAACE,OAAA,CAAAR,UAAA,GAAAA,UAAA;AAAA,IAAAS,QAAA,GAAAD,OAAA,CAAArE,OAAA,GAEaY,yBAAyB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
4
|
-
import { requireNativeComponent, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { NativeModules, requireNativeComponent, StyleSheet, View } from 'react-native';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Which True Fit environment to point at. The native SDKs resolve the widget
|
|
@@ -13,6 +13,8 @@ import { requireNativeComponent, StyleSheet, View } from 'react-native';
|
|
|
13
13
|
* `successType` is `'personal'` when the shopper has a profile-based
|
|
14
14
|
* recommendation, `'general'` for a generic one, and `null` when there is none.
|
|
15
15
|
*/
|
|
16
|
+
|
|
17
|
+
/** One line item in a completed order, reported through {@link trackOrder}. */
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
const NativeTrueFitRecommendationView = requireNativeComponent('TrueFitRecommendationView');
|
|
18
20
|
const DEFAULT_MIN_HEIGHT = 86;
|
|
@@ -75,5 +77,31 @@ const styles = StyleSheet.create({
|
|
|
75
77
|
height: '100%'
|
|
76
78
|
}
|
|
77
79
|
});
|
|
80
|
+
const orderModule = NativeModules.TrueFitOrderModule;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Reports a completed order to True Fit, for the order confirmation screen.
|
|
84
|
+
* Forwards straight to the native SDKs' order API, which posts in the
|
|
85
|
+
* background and never reports delivery back — so there is nothing to await.
|
|
86
|
+
*/
|
|
87
|
+
export const trackOrder = args => {
|
|
88
|
+
const {
|
|
89
|
+
storeKey,
|
|
90
|
+
orderId,
|
|
91
|
+
products,
|
|
92
|
+
environment = 'prod',
|
|
93
|
+
locale
|
|
94
|
+
} = args;
|
|
95
|
+
if (!orderModule) {
|
|
96
|
+
throw new Error("True Fit order tracking is unavailable because the native module is not linked. Rebuild the app after installing 'consumer-app-react-native-sdk' (on iOS, run pod install first).");
|
|
97
|
+
}
|
|
98
|
+
orderModule.trackOrder({
|
|
99
|
+
storeKey,
|
|
100
|
+
orderId,
|
|
101
|
+
products,
|
|
102
|
+
environment,
|
|
103
|
+
locale
|
|
104
|
+
});
|
|
105
|
+
};
|
|
78
106
|
export default TrueFitRecommendationView;
|
|
79
107
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","useState","requireNativeComponent","StyleSheet","View","jsx","_jsx","NativeTrueFitRecommendationView","DEFAULT_MIN_HEIGHT","TrueFitRecommendationView","config","options","style","onPresentationModeChange","onHeightChange","onWidgetResult","onAutoSizeSelect","minHeight","minWidgetHeight","measuredHeight","setMeasuredHeight","presentationMode","setPresentationMode","handleHeightChange","event","nextHeight","Math","max","nativeEvent","height","handlePresentationModeChange","nextMode","mode","styleId","handleWidgetResult","handleAutoSizeSelect","containerStyle","styles","container","zIndex","undefined","elevation","collapsable","children","nativeView","create","width","overflow","position"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC7D,
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","useState","NativeModules","requireNativeComponent","StyleSheet","View","jsx","_jsx","NativeTrueFitRecommendationView","DEFAULT_MIN_HEIGHT","TrueFitRecommendationView","config","options","style","onPresentationModeChange","onHeightChange","onWidgetResult","onAutoSizeSelect","minHeight","minWidgetHeight","measuredHeight","setMeasuredHeight","presentationMode","setPresentationMode","handleHeightChange","event","nextHeight","Math","max","nativeEvent","height","handlePresentationModeChange","nextMode","mode","styleId","handleWidgetResult","handleAutoSizeSelect","containerStyle","styles","container","zIndex","undefined","elevation","collapsable","children","nativeView","create","width","overflow","position","orderModule","TrueFitOrderModule","trackOrder","args","storeKey","orderId","products","environment","locale","Error"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC7D,SACEC,aAAa,EAEbC,sBAAsB,EAEtBC,UAAU,EACVC,IAAI,QAEC,cAAc;;AAErB;AACA;AACA;AACA;;AA8BA;AACA;AACA;AACA;AACA;;AAeA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAgEA,MAAMC,+BAA+B,GAAGL,sBAAsB,CAC5D,2BACF,CAAC;AAED,MAAMM,kBAAkB,GAAG,EAAE;AAE7B,OAAO,SAASC,yBAAyBA,CAAC;EACxCC,MAAM;EACNC,OAAO;EACPC,KAAK;EACLC,wBAAwB;EACxBC,cAAc;EACdC,cAAc;EACdC;AAC8B,CAAC,EAAE;EACjC,MAAMC,SAAS,GAAGN,OAAO,EAAEO,eAAe,IAAIV,kBAAkB;EAChE,MAAM,CAACW,cAAc,EAAEC,iBAAiB,CAAC,GAAGpB,QAAQ,CAACiB,SAAS,CAAC;EAC/D,MAAM,CAACI,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGtB,QAAQ,CAA0B,QAAQ,CAAC;EAE3F,MAAMuB,kBAAkB,GAAGzB,WAAW,CACnC0B,KAA8C,IAAK;IAClD,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAACH,KAAK,CAACI,WAAW,CAACC,MAAM,EAAEZ,SA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A,OAAQ;MACjBC,KAAK,EAAEyB,MAAM,CAACO,UAAW;MACzB9B,cAAc,EAAES,kBAAmB;MACnCV,wBAAwB,EAAEiB,4BAA6B;MACvDf,cAAc,EAAEmB,kBAAmB;MACnClB,gBAAgB,EAAEmB;IAAqB,CACxC;EAAC,CACE,CAAC;AAEX;AAEA,MAAME,MAAM,GAAGlC,UAAU,CAAC0C,MAAM,CAAC;EAC/BP,SAAS,EAAE;IACTQ,KAAK,EAAE,MAAM;IACbC,QAAQ,EAAE,SAAS;IACnBC,QAAQ,EAAE;EACZ,CAAC;EACDJ,UAAU,EAAE;IACVE,KAAK,EAAE,MAAM;IACbjB,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,MAAMoB,WAAiD,GAAGhD,aAAa,CAACiD,kBAAkB;;AAE1F;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAIC,IAAoB,IAAK;EAClD,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,WAAW,GAAG,MAAM;IAAEC;EAAO,CAAC,GAAGL,IAAI;EAE1E,IAAI,CAACH,WAAW,EAAE;IAChB,MAAM,IAAIS,KAAK,CACb,mLACF,CAAC;EACH;EAEAT,WAAW,CAACE,UAAU,CAAC;IAAEE,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,WAAW;IAAEC;EAAO,CAAC,CAAC;AAC9E,CAAC;AAED,eAAehD,yBAAyB","ignoreList":[]}
|
|
@@ -46,6 +46,29 @@ export type TrueFitAutoSizeSelect = {
|
|
|
46
46
|
styleId: string;
|
|
47
47
|
size: string;
|
|
48
48
|
};
|
|
49
|
+
/** One line item in a completed order, reported through {@link trackOrder}. */
|
|
50
|
+
export type TFTrackOrderProduct = {
|
|
51
|
+
/**
|
|
52
|
+
* The style purchased. Must match the ProductID supplied in the Product
|
|
53
|
+
* Catalog feed; line items without one are dropped before the order is sent.
|
|
54
|
+
*/
|
|
55
|
+
productId: string;
|
|
56
|
+
quantity: number;
|
|
57
|
+
/** Unit price paid — the final price if the item was on sale. */
|
|
58
|
+
price: number;
|
|
59
|
+
currency: string;
|
|
60
|
+
colorId?: string;
|
|
61
|
+
size?: string;
|
|
62
|
+
sku?: string;
|
|
63
|
+
};
|
|
64
|
+
export type TrackOrderArgs = {
|
|
65
|
+
storeKey: string;
|
|
66
|
+
orderId: string;
|
|
67
|
+
products: TFTrackOrderProduct[];
|
|
68
|
+
/** Pass the same value the widget uses so both target one backend. */
|
|
69
|
+
environment?: TrueFitEnvironment;
|
|
70
|
+
locale?: string;
|
|
71
|
+
};
|
|
49
72
|
export type TrueFitRecommendationViewProps = {
|
|
50
73
|
config?: TrueFitRecommendationConfig;
|
|
51
74
|
options?: TrueFitRecommendationOptions;
|
|
@@ -56,5 +79,11 @@ export type TrueFitRecommendationViewProps = {
|
|
|
56
79
|
onAutoSizeSelect?: (selection: TrueFitAutoSizeSelect) => void;
|
|
57
80
|
};
|
|
58
81
|
export declare function TrueFitRecommendationView({ config, options, style, onPresentationModeChange, onHeightChange, onWidgetResult, onAutoSizeSelect, }: TrueFitRecommendationViewProps): React.JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* Reports a completed order to True Fit, for the order confirmation screen.
|
|
84
|
+
* Forwards straight to the native SDKs' order API, which posts in the
|
|
85
|
+
* background and never reports delivery back — so there is nothing to await.
|
|
86
|
+
*/
|
|
87
|
+
export declare const trackOrder: (args: TrackOrderArgs) => void;
|
|
59
88
|
export default TrueFitRecommendationView;
|
|
60
89
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D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