@wereform/pkgm-wire 1.0.3 → 1.0.4

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.
@@ -1 +1 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.WireUploadLayout=WireUploadLayout;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _reactNative=require("react-native");var ImagePicker=_interopRequireWildcard(require("expo-image-picker"));var VideoThumbnails=_interopRequireWildcard(require("expo-video-thumbnails"));var _vectorIcons=require("@expo/vector-icons");var _WireUploadStyles=require("../styles/WireUploadStyles");var _pkgmShared=require("@wereform/pkgm-shared");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-wire\\src\\layout\\WireUploadLayout.jsx";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t in e)"default"!==_t&&{}.hasOwnProperty.call(e,_t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t))&&(i.get||i.set)?o(f,_t,i):f[_t]=e[_t]);return f;})(e,t);}function WireUploadLayout(_ref){var _this=this;var profilePic=_ref.profilePic,userName=_ref.userName,onPressVideoUploadScreen=_ref.onPressVideoUploadScreen,onPressWireUpload=_ref.onPressWireUpload;var _useState=(0,_react.useState)(``),_useState2=(0,_slicedToArray2.default)(_useState,2),wireText=_useState2[0],setWireText=_useState2[1];var _useState3=(0,_react.useState)(null),_useState4=(0,_slicedToArray2.default)(_useState3,2),media=_useState4[0],setMedia=_useState4[1];var _useState5=(0,_react.useState)([]),_useState6=(0,_slicedToArray2.default)(_useState5,2),thumbnails=_useState6[0],setThumbnails=_useState6[1];var _useState7=(0,_react.useState)("Default Heading!"),_useState8=(0,_slicedToArray2.default)(_useState7,2),heading=_useState8[0],setHeading=_useState8[1];var pickMedia=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(){var result=yield ImagePicker.launchImageLibraryAsync({mediaTypes:["images","videos"],allowsMultipleSelection:true,selectionLimit:4,quality:1});if(result.canceled)return;var assets=result.assets;setMedia(assets);var finalThumbs=yield Promise.all(assets.map(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(asset){var _asset$mimeType;var isVideo=asset.type==="video"||((_asset$mimeType=asset.mimeType)==null?void 0:_asset$mimeType.startsWith("video"));if(isVideo){try{var _yield$VideoThumbnail=yield VideoThumbnails.getThumbnailAsync(asset.uri,{time:1000}),uri=_yield$VideoThumbnail.uri;return uri;}catch(err){console.log("Video thumbnail error:",err);return null;}}return asset.uri;});return function(_x){return _ref3.apply(this,arguments);};}()));console.log(finalThumbs);setThumbnails(finalThumbs);});return function pickMedia(){return _ref2.apply(this,arguments);};}();console.log(wireText);return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.profileSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:profilePic||"https://begenone-images.s3.us-east-1.amazonaws.com/default-user-photo.jpg"},style:_WireUploadStyles.WireUploadStyles.userImage}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.userInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WireUploadStyles.WireUploadStyles.userName,children:userName||"Default Username"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.wireInputContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:{color:"#fff",fontWeight:"900",fontSize:24,paddingBottom:12,flexGrow:1,justifyContent:"flex-start"},children:["Create ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:"#ff6000"},children:"Wire"})]}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:onPressVideoUploadScreen,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:{color:"#fff",fontWeight:"500",fontSize:14,paddingBottom:12,alignSelf:"center"},children:["Upload ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:"#ff6000"},children:"Video"})]})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.wireInputTextContainer,children:[(0,_jsxRuntime.jsx)(_pkgmShared.InputField,{multiline:true,placeholder:"Write your Wire...",inputWrapper:_WireUploadStyles.WireUploadStyles.inputWrapper,inputStyle:_WireUploadStyles.WireUploadStyles.aboutTextArea,value:wireText,onChangeText:setWireText}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.mediaContainer,children:thumbnails.map(function(uri,index){return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:pickMedia,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:uri},style:_WireUploadStyles.WireUploadStyles.mediaThumb,resizeMode:"cover"})},index);})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.uploadButtonContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:_WireUploadStyles.WireUploadStyles.AIGenerateButton,children:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"sparkles-outline",size:24,color:"#fff"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:pickMedia,style:_WireUploadStyles.WireUploadStyles.uploadImageButton,children:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"image",size:24,color:"#fff"})})]})]}),(0,_jsxRuntime.jsx)(_pkgmShared.DropDown,{styles:{marginLeft:0,marginRight:0,marginTop:18},iconStyles:{paddingRight:16},selectText:"Select Age Group",data:[{key:1,label:"Under 14 of age"},{key:2,label:"Above 14 of age"}]}),(0,_jsxRuntime.jsx)(_pkgmShared.DropDown,{styles:{marginLeft:0,marginRight:0,marginTop:18},selectText:"Comments",iconStyles:{paddingRight:16},data:[{key:1,label:"Turn — ON"},{key:2,label:"Turn — OFF"}]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",width:"auto",justifyContent:"space-between",marginTop:60,marginLeft:24,marginRight:24},children:(0,_jsxRuntime.jsx)(_pkgmShared.CustomizedButton,{label:"Post Wire",style:{backgroundColor:"#ff6000",marginRight:6},fontWeight:"900",textColor:"#fff",onPress:function onPress(){return onPressWireUpload(wireText,heading);}})})]})});}var styles=_reactNative.StyleSheet.create({});
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.WireUploadLayout=WireUploadLayout;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _reactNative=require("react-native");var ImagePicker=_interopRequireWildcard(require("expo-image-picker"));var VideoThumbnails=_interopRequireWildcard(require("expo-video-thumbnails"));var _vectorIcons=require("@expo/vector-icons");var _WireUploadStyles=require("../styles/WireUploadStyles");var _pkgmShared=require("@wereform/pkgm-shared");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-wire\\src\\layout\\WireUploadLayout.jsx";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t in e)"default"!==_t&&{}.hasOwnProperty.call(e,_t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t))&&(i.get||i.set)?o(f,_t,i):f[_t]=e[_t]);return f;})(e,t);}function WireUploadLayout(_ref){var _this=this;var profilePic=_ref.profilePic,userName=_ref.userName,onPressVideoUploadScreen=_ref.onPressVideoUploadScreen,onPressWireUpload=_ref.onPressWireUpload,_ref$showUploadContai=_ref.showUploadContainers,showUploadContainers=_ref$showUploadContai===void 0?false:_ref$showUploadContai,_ref$showDropDowns=_ref.showDropDowns,showDropDowns=_ref$showDropDowns===void 0?false:_ref$showDropDowns;var _useState=(0,_react.useState)(``),_useState2=(0,_slicedToArray2.default)(_useState,2),wireText=_useState2[0],setWireText=_useState2[1];var _useState3=(0,_react.useState)(null),_useState4=(0,_slicedToArray2.default)(_useState3,2),media=_useState4[0],setMedia=_useState4[1];var _useState5=(0,_react.useState)([]),_useState6=(0,_slicedToArray2.default)(_useState5,2),thumbnails=_useState6[0],setThumbnails=_useState6[1];var _useState7=(0,_react.useState)("Default Heading!"),_useState8=(0,_slicedToArray2.default)(_useState7,2),heading=_useState8[0],setHeading=_useState8[1];var pickMedia=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(){var result=yield ImagePicker.launchImageLibraryAsync({mediaTypes:["images","videos"],allowsMultipleSelection:true,selectionLimit:4,quality:1});if(result.canceled)return;var assets=result.assets;setMedia(assets);var finalThumbs=yield Promise.all(assets.map(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(asset){var _asset$mimeType;var isVideo=asset.type==="video"||((_asset$mimeType=asset.mimeType)==null?void 0:_asset$mimeType.startsWith("video"));if(isVideo){try{var _yield$VideoThumbnail=yield VideoThumbnails.getThumbnailAsync(asset.uri,{time:1000}),uri=_yield$VideoThumbnail.uri;return uri;}catch(err){console.log("Video thumbnail error:",err);return null;}}return asset.uri;});return function(_x){return _ref3.apply(this,arguments);};}()));console.log(finalThumbs);setThumbnails(finalThumbs);});return function pickMedia(){return _ref2.apply(this,arguments);};}();console.log(wireText);return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.profileSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:profilePic||"https://begenone-images.s3.us-east-1.amazonaws.com/default-user-photo.jpg"},style:_WireUploadStyles.WireUploadStyles.userImage}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.userInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WireUploadStyles.WireUploadStyles.userName,children:userName||"Default Username"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.wireInputContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:{color:"#fff",fontWeight:"900",fontSize:24,paddingBottom:12,flexGrow:1,justifyContent:"flex-start"},children:["Create ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:"#ff6000"},children:"Wire"})]}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:onPressVideoUploadScreen,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:{color:"#fff",fontWeight:"500",fontSize:14,paddingBottom:12,alignSelf:"center"},children:["Upload ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:"#ff6000"},children:"Video"})]})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.wireInputTextContainer,children:[(0,_jsxRuntime.jsx)(_pkgmShared.InputField,{multiline:true,placeholder:"Write your Wire...",inputWrapper:_WireUploadStyles.WireUploadStyles.inputWrapper,inputStyle:_WireUploadStyles.WireUploadStyles.aboutTextArea,value:wireText,onChangeText:setWireText}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.mediaContainer,children:thumbnails.map(function(uri,index){return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:pickMedia,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:uri},style:_WireUploadStyles.WireUploadStyles.mediaThumb,resizeMode:"cover"})},index);})}),showUploadContainers&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WireUploadStyles.WireUploadStyles.uploadButtonContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:_WireUploadStyles.WireUploadStyles.AIGenerateButton,children:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"sparkles-outline",size:24,color:"#fff"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:pickMedia,style:_WireUploadStyles.WireUploadStyles.uploadImageButton,children:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"image",size:24,color:"#fff"})})]})]}),showDropDowns&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_pkgmShared.DropDown,{styles:{marginLeft:0,marginRight:0,marginTop:18},iconStyles:{paddingRight:16},selectText:"Select Age Group",data:[{key:1,label:"Under 14 of age"},{key:2,label:"Above 14 of age"}]}),(0,_jsxRuntime.jsx)(_pkgmShared.DropDown,{styles:{marginLeft:0,marginRight:0,marginTop:18},selectText:"Comments",iconStyles:{paddingRight:16},data:[{key:1,label:"Turn — ON"},{key:2,label:"Turn — OFF"}]})]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",width:"auto",justifyContent:"space-between",marginTop:60,marginLeft:24,marginRight:24},children:(0,_jsxRuntime.jsx)(_pkgmShared.CustomizedButton,{label:"Post Wire",style:{backgroundColor:"#ff6000",marginRight:6},fontWeight:"900",textColor:"#fff",onPress:function onPress(){return onPressWireUpload(wireText,heading);}})})]})});}var styles=_reactNative.StyleSheet.create({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wereform/pkgm-wire",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "source": "src/index.js",
5
5
  "main": "dist/index.js",
6
6
  "react-native": "src/index.js",
@@ -9,6 +9,10 @@
9
9
  "src",
10
10
  "README.md"
11
11
  ],
12
+ "scripts": {
13
+ "build": "babel src --out-dir dist --extensions .js,.jsx",
14
+ "prepublishOnly": "pnpm run build"
15
+ },
12
16
  "publishConfig": {
13
17
  "access": "public"
14
18
  },
@@ -30,8 +34,5 @@
30
34
  "@babel/core": "^7.28.5",
31
35
  "@babel/preset-env": "^7.28.5",
32
36
  "metro-react-native-babel-preset": "^0.77.0"
33
- },
34
- "scripts": {
35
- "build": "babel src --out-dir dist --extensions .js,.jsx"
36
37
  }
37
- }
38
+ }
@@ -20,6 +20,8 @@ export function WireUploadLayout({
20
20
  userName,
21
21
  onPressVideoUploadScreen,
22
22
  onPressWireUpload,
23
+ showUploadContainers = false,
24
+ showDropDowns = false,
23
25
  }) {
24
26
  const [wireText, setWireText] = useState(``);
25
27
  const [media, setMedia] = useState(null); // image/video URI
@@ -160,43 +162,49 @@ export function WireUploadLayout({
160
162
  </View>
161
163
 
162
164
  {/* 3 — Upload Button */}
163
- <View style={WireUploadStyles.uploadButtonContainer}>
164
- <TouchableOpacity style={WireUploadStyles.AIGenerateButton}>
165
- <Ionicons name="sparkles-outline" size={24} color="#fff" />
166
- </TouchableOpacity>
167
- <TouchableOpacity
168
- onPress={pickMedia}
169
- style={WireUploadStyles.uploadImageButton}
170
- >
171
- <Ionicons name="image" size={24} color="#fff" />
172
- </TouchableOpacity>
173
- </View>
165
+ {showUploadContainers && (
166
+ <View style={WireUploadStyles.uploadButtonContainer}>
167
+ <TouchableOpacity style={WireUploadStyles.AIGenerateButton}>
168
+ <Ionicons name="sparkles-outline" size={24} color="#fff" />
169
+ </TouchableOpacity>
170
+ <TouchableOpacity
171
+ onPress={pickMedia}
172
+ style={WireUploadStyles.uploadImageButton}
173
+ >
174
+ <Ionicons name="image" size={24} color="#fff" />
175
+ </TouchableOpacity>
176
+ </View>
177
+ )}
174
178
  </View>
175
179
 
176
- <DropDown
177
- styles={{
178
- marginLeft: 0,
179
- marginRight: 0,
180
- marginTop: 18,
181
- // paddingRight: 24,
182
- }}
183
- iconStyles={{ paddingRight: 16 }}
184
- selectText={"Select Age Group"}
185
- data={[
186
- { key: 1, label: "Under 14 of age" },
187
- { key: 2, label: "Above 14 of age" },
188
- ]}
189
- />
190
-
191
- <DropDown
192
- styles={{ marginLeft: 0, marginRight: 0, marginTop: 18 }}
193
- selectText={"Comments"}
194
- iconStyles={{ paddingRight: 16 }}
195
- data={[
196
- { key: 1, label: "Turn — ON" },
197
- { key: 2, label: "Turn — OFF" },
198
- ]}
199
- />
180
+ {showDropDowns && (
181
+ <>
182
+ <DropDown
183
+ styles={{
184
+ marginLeft: 0,
185
+ marginRight: 0,
186
+ marginTop: 18,
187
+ // paddingRight: 24,
188
+ }}
189
+ iconStyles={{ paddingRight: 16 }}
190
+ selectText={"Select Age Group"}
191
+ data={[
192
+ { key: 1, label: "Under 14 of age" },
193
+ { key: 2, label: "Above 14 of age" },
194
+ ]}
195
+ />
196
+
197
+ <DropDown
198
+ styles={{ marginLeft: 0, marginRight: 0, marginTop: 18 }}
199
+ selectText={"Comments"}
200
+ iconStyles={{ paddingRight: 16 }}
201
+ data={[
202
+ { key: 1, label: "Turn — ON" },
203
+ { key: 2, label: "Turn — OFF" },
204
+ ]}
205
+ />
206
+ </>
207
+ )}
200
208
  </View>
201
209
 
202
210
  <View