1.2.1 • Published 1 year ago

@officialaccount/components v1.2.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
1 year ago

Official Account component hub

OA Block will display the OA Recommend, OA Nearby, Promotion nearby. The kind of OA Nearest, Similar, Suggestion

Implementation

Required package.json
"react": "17.0.1"
"react-native"
"@momo-kits/core"
"@momo-kits/avatar"
"@momo-platform/api"
"@momo-platform/utils"
"@momo-kits/skeleton"
"@officialaccount/components": "latest"

Required webpack.config.js
include: [
  // ...
  /node_modules(.*[/\\])+@momo-platform[/\\](.*)+/,
  /node_modules(.*[/\\])+@officialaccount[/\\](.*)+/,
]
IMPORT
import { OaHub, TypeDisplay, DisplaySize } from '@officialaccount/components';
enum TypeDisplay  
{
    DEFAULT: 'SUGGESTION',
    SUGGESTION: 'SUGGESTION',
    NEARBY: 'NEARBY',
    NEARBY_OA: 'NEARBY_OA',
    SIMILAR_TO_OA: 'SIMILAR_TO_OA',
    REVIEW: 'REVIEW',
    LIST_NEARBY: 'LIST_NEARBY'
}

enum DisplaySize
{
  DEFAULT: 'SLIDER_SMALL',
  SINGLE_MEDIUM: 'SINGLE_MEDIUM',
  SINGLE_LARGE: 'SINGLE_LARGE',
  SLIDER_SMALL: 'SLIDER_SMALL',
  LIST_MEDIUM: 'LIST_MEDIUM',
}

Props

NameTypeDefaultDescription
paramsObject{}
headerObject{}
typeStringDEFAULT
sizeStringLIST_MEDIUM
styleSectionObject''style content

Params Props

NameTypeRequired
merchant_idStringRequired
store_idString
oa_idNumber
oaIdsList<Number>
storeCodesList<String>
latitudeNumber
longitudeNumber
trackObject{ source, service_name, screen_name }

1 - Usage size SLIDER_SMALL

IMAGE_DESCRIPTION

TYPE = TypeDisplay.SIMILAR_TO_OA 
SIZE = DisplaySize.SLIDER_SMALL 
return (
    <SafeAreaView>
        <OaHub params={{
            oa_id: oa_id,
            store_id: store_id,
            limit: 5,
            track: { source, service_name, screen_name }
          }} header={{
            title: 'QUÁN TƯƠNG TỰ',
            rightButton: {
              buttonTitle: 'Xem thêm',
              refId: 'oa_local_discovery'
            },
            isShowHeader: true, //default is true
          }}
          type={ TypeDisplay.SIMILAR_TO_OA }
          size= { DisplaySize.SLIDER_SMALL }/>
    </SafeAreaView>
)

2 - Usage size LIST_MEDIUM

IMAGE_DESCRIPTION

props keyTypeRequiredDescription
typeenumrequiredTypeDisplay.DEFAULT
sizeenumrequiredDisplaySize.LIST_MEDIUM
paramsobjectrequired
slocation
onloadDoneFunctionoptionfunction callback api response
headerobjectoptioncustom header view
styleSectionobjectoptioncustom header style
params keyTypeRequiredDescription
merchant_idStringrequiredDefault value is 0
oaIdsStringoptionlist oaId
latitudenumberoptionlocation
longitudenumberoption
location
TYPE = TypeDisplay.DEFAULT 
SIZE = DisplaySize.LIST_MEDIUM 
LOCATION is optional 
return (
    <SafeAreaView>
        <OaHub 
        type={ TypeDisplay.DEFAULT }
        size={ DisplaySize.LIST_MEDIUM }
        params={{
          merchant_id: merchant_id,
          store_id: store_id,
          oaIds: '1,2,3', 
          storeCodes: '1,2,3', 
          limit: 3,
          latitude: 10.7741709,
          longitude: 106.7014805,
          distance: 20, //unit = km
          locationRequired: true, //default is true - show popup location if need
          track: { source, service_name, screen_name }
        }} 
        header={{
          title: 'Cửa hàng gần bạn',
          isShowHeader: false, //default is true,
          styleHeaderTitle: { fontWeight: 'bold', fontSize: 16 },
        }}
        styleSection={{
          marginHorizontal: 0,
          paddingHorizontal: 0
        }}
        />
    </SafeAreaView>
)

3 - Usage size SINGLE_MEDIUM

IMAGE_DESCRIPTION

props keyTypeRequiredDescription
typeenumrequiredDEFAULT or LIST_NEARBY
sizeenumrequiredDisplaySize.SINGLE_MEDIUM
paramsobjectrequired
onloadDoneFunctionoptionfunction callback api response
headerobjectoptioncustom header view
styleSectionobjectoptioncustom header style
params keyTypeRequiredDescription
oaIdnumberrequirednumber oaId
oaIdsStringrequiredlist oaId
latitudenumberrequiredlocation
longitudenumberoption
location
trackobjectrequired
tracking source
TYPE = TypeDisplay.DEFAULT 
SIZE = DisplaySize.SINGLE_MEDIUM or DisplaySize.LIST_MEDIUM 
LOCATION is optional 

return (
    <SafeAreaView>
        <OaHub 
        type={ TypeDisplay.DEFAULT }
        size={ DisplaySize.SINGLE_MEDIUM }
        params={{
          oa_id: 1237, //required 
          oaIds: '1237,1240,1241,1243,1244,1247,1253,1259,1262', //required 
          latitude: 10.7741709, //optional 
          longitude: 106.7014805, //optional 
          track: { source, service_name, screen_name }
        }} 
        header={{
          title: '',
          isShowHeader: true, //default is true,
          styleHeaderTitle: {
            fontSize: 15,
            fontWeight: 'bold',
          }
          isShowArrow: true, //default is true,
          enableViewAll: true, //default is true. Set false In case disable click on header title
        }}
        styleSection={{
          marginHorizontal: 0,
          paddingHorizontal: 0
        }}
        />
    </SafeAreaView>
)

Version 0.3.20 or newest

OA LISTING screen by Type LIST_NEARBY & sorting Neaby first IMAGE_DESCRIPTION OA LISTING screen by Type LIST_NEARBY & sorting Rating first IMAGE_DESCRIPTION

4- OA Statistics

Version 0.3.6 or newest IMAGE_DESCRIPTION

NameTypeRequiredDescription
merchantCodeStringrequired
storeCodeStringoption
filterStringrequiredALL, TODAY, YESTERDAY, LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS
onloadDoneFunctionoptionfunction callback api response
styleContainerObjectoptionstyle of Container
styleContentObjectoptionstyle of content
styleBlockTitleObjectoptionstyle of header
styleTextTitleObjectoptionstyle of title header
import { OAStats } from '@officialaccount/components';
<OAStats 
  params={{
    merchantCode, 
    storeCode, 
    filter: 'LAST_7_DAYS',
    title: 'Trang doanh nghiệp',
    styleContainer,
    styleContent,
    styleBlockTitle,
    styleTextTitle,
  }}
  onloadDone={callback}
/>

5 - Usage size SINGLE_SMALL

IMAGE_DESCRIPTION

props keyTypeRequiredDescription
typeenumrequiredDisplaySize.DEFAULT
sizeenumrequiredDisplaySize.SINGLE_SMALL
paramsobjectrequired
onloadDoneFunctionoptionfunction callback api response
styleSectionobjectoptioncustom container style
styleContentobjectoptioncustom inner style
params keyTypeRequiredextra data param
----------------------------------------------------------------------------------------------------------------------
oaIdnumberrequirednumber oaId
merchantCodeStringrequiredmerchantCode
TYPE = TypeDisplay.DEFAULT 
SIZE = DisplaySize.SINGLE_SMALL

return (
    <SafeAreaView>
        <OaHub 
        type={TypeDisplay.DEFAULT} 
        size={DisplaySize.SINGLE_SMALL}
        styleSection={{}}
        params={{
            merchantCode,
            oaId,
            hasContainer: true,
        }}/>
    </SafeAreaView>
)
Version 1.1.31
Handle Error token expired (errorCode 21) and token invalid  (errorCode 22)

Container

1.2.1

1 year ago

1.2.0

1 year ago

1.1.38

1 year ago

1.1.39

1 year ago

1.1.37

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.36

1 year ago

1.1.35

1 year ago

1.1.32

1 year ago

1.1.29

1 year ago

1.1.28

1 year ago

1.1.30

1 year ago

1.1.31

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.19

1 year ago

1.1.20

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.14

1 year ago

1.1.12

1 year ago

1.1.13

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.18

2 years ago

1.0.20

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.9

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.8

2 years ago

1.0.2

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

0.3.27

2 years ago

0.3.25

2 years ago

0.3.24

2 years ago

0.3.23

2 years ago

0.3.22

2 years ago

0.3.21

2 years ago

0.3.20

2 years ago

0.3.19

2 years ago

0.3.18

2 years ago

0.3.17

2 years ago

0.3.16

2 years ago

0.3.15

2 years ago

0.3.14

2 years ago

0.3.13

2 years ago

0.3.12

2 years ago

0.3.9

2 years ago

0.3.11

2 years ago

0.3.10

2 years ago

0.2.90

2 years ago

0.3.0

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.2

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.82

2 years ago

0.2.81

2 years ago

0.2.80

2 years ago

0.2.74

2 years ago

0.2.73

2 years ago

0.2.72

2 years ago

0.2.71

2 years ago

0.2.70

2 years ago

0.2.79

2 years ago

0.2.76

2 years ago

0.2.75

2 years ago

0.2.63

2 years ago

0.2.62

2 years ago

0.2.60

2 years ago

0.2.68

2 years ago

0.2.67

2 years ago

0.2.66

2 years ago

0.2.65

2 years ago

0.2.64

2 years ago

0.2.52

2 years ago

0.2.51

2 years ago

0.2.50

2 years ago

0.2.59

2 years ago

0.2.58

2 years ago

0.2.57

2 years ago

0.2.56

2 years ago

0.2.55

2 years ago

0.2.54

2 years ago

0.2.53

2 years ago

0.2.40

2 years ago

0.2.48

2 years ago

0.2.47

2 years ago

0.2.46

2 years ago

0.2.45

2 years ago

0.2.44

2 years ago

0.2.43

2 years ago

0.2.42

2 years ago

0.2.39

2 years ago

0.2.38

2 years ago

0.2.37

2 years ago

0.2.36

2 years ago

0.2.35

2 years ago

0.2.33

2 years ago

0.2.27

2 years ago

0.2.26

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.30

2 years ago

0.2.32

2 years ago

0.2.31

2 years ago

0.2.29

2 years ago

0.2.28

2 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.15

3 years ago

0.1.41

3 years ago

0.1.43

3 years ago

0.1.44

3 years ago

0.1.45

3 years ago

0.1.46

3 years ago

0.1.47

3 years ago

0.1.48

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.1.40

3 years ago

0.1.38

3 years ago

0.1.8

3 years ago

0.1.39

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.30

3 years ago

0.1.31

3 years ago

0.1.32

3 years ago

0.1.33

3 years ago

0.1.34

3 years ago

0.1.35

3 years ago

0.1.36

3 years ago

0.1.37

3 years ago

0.1.27

3 years ago

0.1.28

3 years ago

1.0.42

3 years ago

0.1.29

3 years ago

1.0.41

3 years ago

0.1.20

3 years ago

0.1.21

3 years ago

0.1.22

3 years ago

0.1.23

3 years ago

0.1.24

3 years ago

0.1.25

3 years ago

0.1.26

3 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.16

3 years ago

0.2.6

2 years ago

0.1.17

3 years ago

0.2.9

2 years ago

0.1.18

3 years ago

0.2.8

2 years ago

0.1.19

3 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago