@whatmore-repo/whatmore-reactnative-sdk 1.0.11 → 1.0.13
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/commands.txt +45 -38
- package/index.js +31 -31
- package/package.json +29 -29
- package/pre-integration-steps.txt +2 -2
- package/src/api/cart-commands/CartCommands.js +26 -26
- package/src/api/navigation-commands/NavigationCommands.js +16 -16
- package/src/api/partners/PartnerUtils.js +10 -10
- package/src/api/partners/appbrew/AppbrewCommands.js +26 -26
- package/src/api/product-details-commands/ProductDetailsCommands.js +389 -389
- package/src/api/shopify-commands/ShopifyCommands.js +28 -28
- package/src/api/whatmore-backend/WhatmoreMetricCommands.js +159 -159
- package/src/components/EventClickComponent.js +30 -30
- package/src/components/EventShoppingOverlay.js +75 -74
- package/src/components/EventShoppingView.js +31 -31
- package/src/components/EventsVerticalSwipeView.js +59 -59
- package/src/components/EventsVerticalSwipeViewNoModal.js +51 -51
- package/src/components/WhatmoreRootComponent.js +88 -88
- package/src/components/commons/AppMuteUnmuteIcon.js +35 -35
- package/src/components/cta-buttons/AddToCartButton.jsx +345 -345
- package/src/components/product-tiles/ProductPriceBadge.js +51 -51
- package/src/components/product-tiles/ProductTileV1.js +204 -204
- package/src/components/product-tiles/SelectVariantComponent.js +116 -116
- package/src/components/video-player/AppVideoPlayer.js +25 -25
- package/src/constants/AppGlobalVars.js +12 -12
- package/src/globals/useAppState_APP.js +17 -17
- package/src/hooks/useAddToCartStates.js +194 -194
- package/src/{components/icons → icons}/icon-components/CartIcon.jsx +26 -26
- package/src/{components/icons → icons}/icon-components/LoadingIcon.jsx +17 -17
- package/src/{components/icons → icons}/icon-components/MuteIcon.jsx +22 -22
- package/src/{components/icons → icons}/icon-components/PlusIcon.jsx +26 -26
- package/src/{components/icons → icons}/icon-components/UnmuteIcon.jsx +22 -22
- package/src/{components/icons → icons}/svg-utils.txt +6 -6
- package/src/utils/ColorUtils.js +39 -39
- package/src/utils/EventSanityUtils.js +21 -21
- package/src/utils/PriceUtils.js +27 -27
- package/src/utils/ProductUtils.js +5 -5
package/commands.txt
CHANGED
|
@@ -1,39 +1,46 @@
|
|
|
1
|
-
##
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
nvm
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
emulator -
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
adb start-server
|
|
20
|
-
adb kill-server
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
npm
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
## starting server
|
|
2
|
+
npm start --reset-cache
|
|
3
|
+
npm run android
|
|
4
|
+
|
|
5
|
+
## nvm usage
|
|
6
|
+
nvm install ^16.0.0
|
|
7
|
+
nvm list
|
|
8
|
+
nvm use 16.0.0
|
|
9
|
+
nvm use 14.19.3
|
|
10
|
+
|
|
11
|
+
## Starting android emulator
|
|
12
|
+
cd C:\Users\shyam\AppData\Local\Android\Sdk\emulator
|
|
13
|
+
emulator -list-avds
|
|
14
|
+
emulator -avd Pixel_6_API_33
|
|
15
|
+
emulator -avd Nexus_5X_API_33
|
|
16
|
+
|
|
17
|
+
## Starting adb
|
|
18
|
+
set ADB_TRACE=1
|
|
19
|
+
adb start-server
|
|
20
|
+
adb kill-server
|
|
21
|
+
adb devices
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## publishing npm package
|
|
25
|
+
npm publish --access public
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Clear cache and reinstall
|
|
29
|
+
rmdir /s /q node_modules
|
|
30
|
+
npm cache clean --force
|
|
31
|
+
npm install
|
|
32
|
+
npm link ./whatmore-reactnative-sdk
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Windows
|
|
36
|
+
## Stop process at port
|
|
37
|
+
netstat -ano | findstr :19000
|
|
38
|
+
taskkill /PID 4584 /F
|
|
39
|
+
|
|
40
|
+
## Recursively delete folder
|
|
41
|
+
rmdir /s /q folder-name
|
|
42
|
+
del /F /Q package-lock.json
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Link node_modules from local
|
|
39
46
|
npm link ./whatmore-reactnative-sdk # solves no module found errors
|
package/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import WhatmoreRootComponent from "./src/components/WhatmoreRootComponent.js";
|
|
3
|
-
import { setGlobalState } from "./src/globals/useAppState_APP.js";
|
|
4
|
-
import { View } from "react-native";
|
|
5
|
-
|
|
6
|
-
export function WhatmoreBase(props){
|
|
7
|
-
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
setGlobalState('whatmoreShopId', props.shopId);
|
|
10
|
-
setGlobalState('brandDomainContext', props.domainContext);
|
|
11
|
-
setGlobalState('commandsObject', props.commandsObject);
|
|
12
|
-
setGlobalState('template', props.template);
|
|
13
|
-
setGlobalState('modalUsed', props.modalUsed);
|
|
14
|
-
setGlobalState('activateMock', props.activateMock);
|
|
15
|
-
}, []);
|
|
16
|
-
|
|
17
|
-
// return (
|
|
18
|
-
// <View style={{
|
|
19
|
-
// width: '100%', height: '100%',
|
|
20
|
-
// backgroundColor: 'red'
|
|
21
|
-
// }}>
|
|
22
|
-
|
|
23
|
-
// </View>
|
|
24
|
-
// );
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<WhatmoreRootComponent shopId={props.shopId} />
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import WhatmoreRootComponent from "./src/components/WhatmoreRootComponent.js";
|
|
3
|
+
import { setGlobalState } from "./src/globals/useAppState_APP.js";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
|
|
6
|
+
export function WhatmoreBase(props){
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setGlobalState('whatmoreShopId', props.shopId);
|
|
10
|
+
setGlobalState('brandDomainContext', props.domainContext);
|
|
11
|
+
setGlobalState('commandsObject', props.commandsObject);
|
|
12
|
+
setGlobalState('template', props.template);
|
|
13
|
+
setGlobalState('modalUsed', props.modalUsed);
|
|
14
|
+
setGlobalState('activateMock', props.activateMock);
|
|
15
|
+
}, []);
|
|
16
|
+
|
|
17
|
+
// return (
|
|
18
|
+
// <View style={{
|
|
19
|
+
// width: '100%', height: '100%',
|
|
20
|
+
// backgroundColor: 'red'
|
|
21
|
+
// }}>
|
|
22
|
+
|
|
23
|
+
// </View>
|
|
24
|
+
// );
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<WhatmoreRootComponent shopId={props.shopId} />
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@whatmore-repo/whatmore-reactnative-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"private": false,
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
-
},
|
|
10
|
-
"keywords": [
|
|
11
|
-
"whatmore"
|
|
12
|
-
],
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"currency-symbol-map": "^5.1.0",
|
|
15
|
-
"react": "18.2.0",
|
|
16
|
-
"react-hooks-global-state": "^2.1.0",
|
|
17
|
-
"react-native": "0.
|
|
18
|
-
"react-native-animatable": "^1.3.3",
|
|
19
|
-
"react-native-intersection-observer": "^0.0.9",
|
|
20
|
-
"react-native-svg": "^13.10.0",
|
|
21
|
-
"react-native-swiper": "^1.6.0",
|
|
22
|
-
"react-native-video": "^5.2.1"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@babel/core": "^7.20.0"
|
|
26
|
-
},
|
|
27
|
-
"author": "Shyam",
|
|
28
|
-
"license": "ISC"
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@whatmore-repo/whatmore-reactnative-sdk",
|
|
3
|
+
"version": "1.0.13",
|
|
4
|
+
"description": "",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"whatmore"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"currency-symbol-map": "^5.1.0",
|
|
15
|
+
"react": "18.2.0",
|
|
16
|
+
"react-hooks-global-state": "^2.1.0",
|
|
17
|
+
"react-native": "^0.71.13",
|
|
18
|
+
"react-native-animatable": "^1.3.3",
|
|
19
|
+
"react-native-intersection-observer": "^0.0.9",
|
|
20
|
+
"react-native-svg": "^13.10.0",
|
|
21
|
+
"react-native-swiper": "^1.6.0",
|
|
22
|
+
"react-native-video": "^5.2.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@babel/core": "^7.20.0"
|
|
26
|
+
},
|
|
27
|
+
"author": "Shyam",
|
|
28
|
+
"license": "ISC"
|
|
29
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
1. Libraries for react-native linking
|
|
2
|
-
"react-native-svg": "^13.10.0",
|
|
1
|
+
1. Libraries for react-native linking
|
|
2
|
+
"react-native-svg": "^13.10.0",
|
|
3
3
|
"react-native-video": "^5.2.1"
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { getGlobalState } from "../../globals/useAppState_APP";
|
|
2
|
-
import { isAppBrew, isAppMaker, isPlobalApps } from "../partners/PartnerUtils.js";
|
|
3
|
-
import { appbrewAddToCartCommand } from "../partners/appbrew/AppbrewCommands";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param {*} variantId
|
|
8
|
-
* @param {*} itemQuantity
|
|
9
|
-
* @param {*} product
|
|
10
|
-
* @param {*} brandDomainContext
|
|
11
|
-
* @param {*} whatmoreShopId
|
|
12
|
-
* @returns Promise => true if command is executed successfully, false otherwise
|
|
13
|
-
*/
|
|
14
|
-
export async function addToCartCommand(variantId, itemQuantity, product, brandDomainContext, whatmoreShopId){
|
|
15
|
-
const _ACTIVATE_MOCK_ = getGlobalState("activateMock");
|
|
16
|
-
|
|
17
|
-
if(_ACTIVATE_MOCK_){
|
|
18
|
-
return Promise.resolve(true);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if(isAppBrew(brandDomainContext)){
|
|
22
|
-
return await appbrewAddToCartCommand(variantId, itemQuantity, product, whatmoreShopId);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return Promise.resolve(false);
|
|
26
|
-
}
|
|
1
|
+
import { getGlobalState } from "../../globals/useAppState_APP";
|
|
2
|
+
import { isAppBrew, isAppMaker, isPlobalApps } from "../partners/PartnerUtils.js";
|
|
3
|
+
import { appbrewAddToCartCommand } from "../partners/appbrew/AppbrewCommands";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {*} variantId
|
|
8
|
+
* @param {*} itemQuantity
|
|
9
|
+
* @param {*} product
|
|
10
|
+
* @param {*} brandDomainContext
|
|
11
|
+
* @param {*} whatmoreShopId
|
|
12
|
+
* @returns Promise => true if command is executed successfully, false otherwise
|
|
13
|
+
*/
|
|
14
|
+
export async function addToCartCommand(variantId, itemQuantity, product, brandDomainContext, whatmoreShopId){
|
|
15
|
+
const _ACTIVATE_MOCK_ = getGlobalState("activateMock");
|
|
16
|
+
|
|
17
|
+
if(_ACTIVATE_MOCK_){
|
|
18
|
+
return Promise.resolve(true);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if(isAppBrew(brandDomainContext)){
|
|
22
|
+
return await appbrewAddToCartCommand(variantId, itemQuantity, product, whatmoreShopId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return Promise.resolve(false);
|
|
26
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import { getGlobalState } from "../../globals/useAppState_APP.js";
|
|
3
|
-
import { isAppBrew, isAppMaker, isPlobalApps } from "../partners/PartnerUtils.js";
|
|
4
|
-
import { appbrewNavigateToProductPageCommand } from "../partners/appbrew/AppbrewCommands.js";
|
|
5
|
-
|
|
6
|
-
export async function navigateToProductPage(product, brandDomainContext, whatmoreShopId) {
|
|
7
|
-
const _ACTIVATE_MOCK_ = getGlobalState("activateMock");
|
|
8
|
-
if (_ACTIVATE_MOCK_) {
|
|
9
|
-
return Promise.resolve(true);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if(isAppBrew(brandDomainContext)){
|
|
13
|
-
return await appbrewNavigateToProductPageCommand(product, whatmoreShopId);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return Promise.resolve(false);
|
|
1
|
+
|
|
2
|
+
import { getGlobalState } from "../../globals/useAppState_APP.js";
|
|
3
|
+
import { isAppBrew, isAppMaker, isPlobalApps } from "../partners/PartnerUtils.js";
|
|
4
|
+
import { appbrewNavigateToProductPageCommand } from "../partners/appbrew/AppbrewCommands.js";
|
|
5
|
+
|
|
6
|
+
export async function navigateToProductPage(product, brandDomainContext, whatmoreShopId) {
|
|
7
|
+
const _ACTIVATE_MOCK_ = getGlobalState("activateMock");
|
|
8
|
+
if (_ACTIVATE_MOCK_) {
|
|
9
|
+
return Promise.resolve(true);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if(isAppBrew(brandDomainContext)){
|
|
13
|
+
return await appbrewNavigateToProductPageCommand(product, whatmoreShopId);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return Promise.resolve(false);
|
|
17
17
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export function isAppBrew(brandDomainContext){
|
|
2
|
-
return brandDomainContext == "appbrew";
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function isAppMaker(brandDomainContext){
|
|
6
|
-
return brandDomainContext == "appmaker";
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function isPlobalApps(brandDomainContext){
|
|
10
|
-
return brandDomainContext == "plobalapps";
|
|
1
|
+
export function isAppBrew(brandDomainContext){
|
|
2
|
+
return brandDomainContext == "appbrew";
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function isAppMaker(brandDomainContext){
|
|
6
|
+
return brandDomainContext == "appmaker";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function isPlobalApps(brandDomainContext){
|
|
10
|
+
return brandDomainContext == "plobalapps";
|
|
11
11
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { getGlobalState } from "../../../globals/useAppState_APP";
|
|
2
|
-
import { getProductHandle } from "../../../utils/ProductUtils";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export async function appbrewNavigateToProductPageCommand(product, whatmoreShopId){
|
|
6
|
-
const appbrewCommands = getGlobalState("commandsObject");
|
|
7
|
-
if(appbrewCommands && appbrewCommands.navigate){
|
|
8
|
-
appbrewCommands.navigate({
|
|
9
|
-
kind: 'screen',
|
|
10
|
-
screenId: 'product',
|
|
11
|
-
options: {
|
|
12
|
-
productHandle: getProductHandle(product)
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return Promise.resolve(true);
|
|
16
|
-
}
|
|
17
|
-
return Promise.resolve(false);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function appbrewAddToCartCommand(productVariantId, itemQuantity, product, whatmoreShopId){
|
|
21
|
-
const appbrewCommands = getGlobalState("commandsObject");
|
|
22
|
-
if(appbrewCommands && appbrewCommands.addToCart){
|
|
23
|
-
appbrewCommands.addToCart(productVariantId,itemQuantity);
|
|
24
|
-
return Promise.resolve(true);
|
|
25
|
-
}
|
|
26
|
-
return Promise.resolve(false);
|
|
1
|
+
import { getGlobalState } from "../../../globals/useAppState_APP";
|
|
2
|
+
import { getProductHandle } from "../../../utils/ProductUtils";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export async function appbrewNavigateToProductPageCommand(product, whatmoreShopId){
|
|
6
|
+
const appbrewCommands = getGlobalState("commandsObject");
|
|
7
|
+
if(appbrewCommands && appbrewCommands.navigate){
|
|
8
|
+
appbrewCommands.navigate({
|
|
9
|
+
kind: 'screen',
|
|
10
|
+
screenId: 'product',
|
|
11
|
+
options: {
|
|
12
|
+
productHandle: getProductHandle(product)
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return Promise.resolve(true);
|
|
16
|
+
}
|
|
17
|
+
return Promise.resolve(false);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function appbrewAddToCartCommand(productVariantId, itemQuantity, product, whatmoreShopId){
|
|
21
|
+
const appbrewCommands = getGlobalState("commandsObject");
|
|
22
|
+
if(appbrewCommands && appbrewCommands.addToCart){
|
|
23
|
+
appbrewCommands.addToCart(productVariantId,itemQuantity);
|
|
24
|
+
return Promise.resolve(true);
|
|
25
|
+
}
|
|
26
|
+
return Promise.resolve(false);
|
|
27
27
|
}
|